【发布时间】:2017-10-12 22:35:38
【问题描述】:
我是 typescript 的新手,我想做的就是将我的 typescript 文件转换为 javascript 当我执行 npm typescript --verison 时,我得到 3.10.10
我有这样的 task.json 文件
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "${cwd}/node_modules/.bin/tsc.cmd",
"isShellCommand": true,
"args": [
"-p",
"."
],
"showOutput": "silent",
"problemMatcher": "$tsc"
}
和 tsconfig.json 这样的文件
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
当我执行 tsc mock.ts tsc 时,我收到这样的错误
'tsc' 不是内部或外部命令,可操作 程序或批处理文件。
在博客中进行了一些研究后,我在我的 tasks.json 文件中使用了它
"command": "${cwd}/node_modules/.bin/tsc.cmd", 但我无法将我的 .ts 文件编译成 javascript
【问题讨论】:
标签: javascript node.js typescript typescript-compiler-api