我独自跟着VS Code typescript配置。如何在VScode中设置打字稿?
https://code.visualstudio.com/Docs/languages/typescript
我安装我的tsconfig.json像
{
"compilerOptions": {
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"outFile": "built/local/tsc.js",
"sourceMap": true
},
"include": [
"**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
,我的任务运行
{
// 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"
}
我的TS码
class StartUp {
public static main(): number {
console.log('Helle Workd');
return 5;
}
}
console.log('test');
StartUp.main();
对于一些reaso n,当我按下cmd + shift + B(build)时,在输出窗口中看不到任何输出。我确实看到如下错误:
hello.ts(8,1): error TS2304: Cannot find name 'ddd'.
如果我在代码中随机添加ddd字符串。
有人可以帮我解决这个问题吗?非常感谢!
是生成的文件好吗?也许你可以运行“tsc -p”。在控制台。如果没有错误,命令将不会输出。 – Yuan