我是新來的打字稿,我想要做的是將我的打字稿文件轉換爲javascript 當我做npm打字稿--verison時,我得到3.10.10無法編譯.ts到.js在Vs - windows
我有我的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文件
「命令」 用這個博客的一個小小的研究後: 「$ {} CWD /node_modules/.bin/tsc.cmd」, 但我不能夠編譯我的.ts文件轉換爲JavaScript