【发布时间】:2018-07-26 15:52:47
【问题描述】:
我有 hw.ts 包含此内容的文件:
function greeter(x: string) {
return "Hello" + x;
}
let u = "John";
document.body.innerHTML = greeter(u);
我选择Start without debugging,VSCode 说:
Cannot launch program 'hw.ts' because corresponding JavaScript cannot be found.
好的,所以我从命令行编译文件:
tsc hw.ts
现在我确实在同一个文件夹中有hw.js。
所以我再次选择Start without debugging,VSCode 再次显示Cannot launch program 'hw.ts' because corresponding JavaScript cannot be found.。
有没有办法从 VSCode 编译和运行 TypeScript 程序?我错过了什么?
(我的PATH 中确实有node,它应该对VSCode 可见)
【问题讨论】:
标签: javascript typescript visual-studio-code