我安装了 Visual Studio Code(版本 1.7.2)和 typescript 1.8。我在一个文件夹中构建了一个简单的 react-native 项目。(反应应用程序工作得很好,因为我可以在调试器中运行它)。现在我尝试整合打字稿。但是 vs code 不会在保存(ctrl+s)和构建(ctrl+b)时转换我的代码。这是我的tsconfig.json
文件(位于我的项目的根目录中):
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"noImplicitAny": true
},
"compileOnSave": true,
"exclude": [
"node_modules"
]
}
这是tasks.json
文件:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.8\\tsc",
"isShellCommand": true,
"args": ["-p", "."],
"showOutput": "always",
"problemMatcher": "$tsc"
}
编译发生得很好,因为 vs 代码能够从测试文件调用“mytest.ts”中挑选语法错误但是在保存或构建时没有生成“mytest.js”文件。我已按照此https://code.visualstudio.com/Docs/languages/typescript的说明进行操作
我仍然无法让 vs code 转译我的代码。
任何帮助,提示正确方向将不胜感激。
先感谢您