【发布时间】:2017-02-18 07:46:28
【问题描述】:
我只关注 VS Code 打字稿配置。
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();
由于某种原因,当我按 cmd + shift + B(构建)时,我在输出窗口中看不到任何输出。我确实看到了类似的错误
hello.ts(8,1): error TS2304: Cannot find name 'ddd'.
如果我在代码中随机添加 ddd 字符串。
有人可以帮我解决这个问题吗?非常感谢!
【问题讨论】:
-
生成的文件正常吗?也许你可以运行“tsc -p”。在控制台中。如果没有错误,该命令将不会输出任何内容。
标签: javascript typescript compiler-errors visual-studio-code