【发布时间】:2016-08-16 10:55:54
【问题描述】:
我刚刚安装了 vs code v1(最新版本)和 typescript v1.8.10(最新版本)。 我遵循了来自 vs code website 的确切说明,但无法获取 vs code 来构建最简单的 typescript 文件,尽管我可以通过在 git bash 中运行 tsc 命令手动构建它。 vs 代码的输出是:
error TS5007: Cannot resolve referenced file: '.'.
error TS5023: Unknown option 'p'
Use the '--help' flag to see options.
这是我的 helloworld.ts 文件,真是再简单不过了:
class Greet {
private _message : string;
constructor(message : string) {
this._message = message;
}
Say = () => console.log(this._message);
}
var g = new Greet('hello typescript!');
g.Say();
这是我的 tasks.json 文件:
{
// See http://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": "silent",
"problemMatcher": "$tsc"
}
和 tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true
}
}
【问题讨论】:
标签: typescript visual-studio-code