Ich folge allein mit der VS-Code typescript-Konfiguration.Wie man Typoskript in VScode einrichtet?
https://code.visualstudio.com/Docs/languages/typescript
ich mein Setup tsconfig.json wie
haben{
"compilerOptions": {
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"outFile": "built/local/tsc.js",
"sourceMap": true
},
"include": [
"**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
und meine Aufgabe Läufer
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-p", "."],
"showOutput": "always",
"problemMatcher": "$tsc"
}
Meine ts Codes
class StartUp {
public static main(): number {
console.log('Helle Workd');
return 5;
}
}
console.log('test');
StartUp.main();
Für einige reaso n, ich sehe keine Ausgabe im Ausgabefenster, wenn ich Cmd + Shift + B (Build) drücke. Ich sehe Fehler wie
hello.ts(8,1): error TS2304: Cannot find name 'ddd'.
wenn ich zufällig ddd Zeichenfolge in den Codes hinzufügen.
Kann mir jemand helfen, dieses Problem zu lösen? Vielen Dank!
die erzeugten Dateien sind OK? Vielleicht kannst du "tsc -p." in der Konsole. Der Befehl gibt keinen, wenn kein Fehler aus. – Yuan