我在vscode中使用了这个tasks.json文件:
{
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-p", "."],
"showOutput": "silent",
"problemMatcher": "$tsc"
}
VsCode告诉我:
error TS5007: Cannot resolve referenced file: '.'.
error TS5023: Unknown option 'p'
Use the '--help' flag to see options.
这是项目结构:
│ .gitignore
│ package.json
│ tsconfig.json
│
├───.vscode
│ settings.json
│ tasks.json
└───src
│ configuration.ts
│ index.ts
│ variables.ts
│
├───api
│ api.ts
│ UsersApi.ts
│
└───model
models.ts
我已经创建了一个公共存储库,以便您能够在那里查看。 Here you can see the files
答案 0 :(得分:0)
看起来该任务正在提升tsc
的早期版本。我相信在Typescript 1.5中添加了-p
标志。
要检查此问题,请尝试使用以下tasks.json
:
{
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["--version"]
}
然后检查vscode中的输出窗口: shift cmd u
显示正在拾取的TypeScript版本。
要获得新版本的TS,您可以:
npm install -g typescript
npm install typescript
"command": "./node_modules/typescript/bin/tsc"
并使用tasks.json