在Visual Studio Code IDE中编译.ts文件时,无法读取未定义错误的属性'args'

时间:2017-07-01 10:38:42

标签: javascript typescript visual-studio-code

我写了一个tsconfig.json文件,其中包含

{
    "compilerOptions": {
        "target": "es5"
    }
}

我的HelloWorld.ts文件包含

function SayHello() {
    let x = "Hello World!";
    alert(x);
}

但是,当我使用 Ctrl + Shift + B 在Visual Studio代码中编译此代码时,我收到以下错误(在输出窗口),

Cannot read property 'args' of undefined

我的NodeJS版本是7.8.0,TypeScript版本是2.3.4

有人可以帮助解决这里出了什么问题吗?

1 个答案:

答案 0 :(得分:1)

我已经解决了,这个网址提供了可靠的答案。 地址:https://github.com/Microsoft/TypeScript/issues/16850

这可能是Visual Studio Code集成的一个问题,您可以尝试打开命令面板并尝试键入" configure task runner"并选择" TypeScript-tsconfig.json"然后vscode将在当前Project下自动生成一个.vscode文件夹,并生成以下tasks.json文件。

{
  "version": "0.1.0",
  "command": "tsc",
  "isShellCommand": true,
  "showOutput": "always"
}