atom-typescript - 为什么这些Typescript配置选项无法识别?

时间:2016-04-19 17:35:46

标签: typescript atom-editor

为什么我会收到下面屏幕截图中显示的错误?

Atom说我的tsconfig.json'项目文件包含无效的选项' for allowJs,buildOnSave和compileOnSave。

但应允许这些设置:https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md

enter image description here

2 个答案:

答案 0 :(得分:2)

compileOnSavebuildOnSave不在CompilerOptions之下。像这样:

{
  "compileOnSave": true,
  "buildOnSave": false,
  "compilerOptions": {
    "module": "system",
    "noImplicitAny": true,
    "preserveConstEnums": true,
    "removeComments": true,
    "sourceMap": true,
    "target": "es5"
    },
    "exclude": [
    "node_modules",
    "wwwroot/lib",
    "typings/main",
    "typings/main.d.ts"
  ]
}

似乎不支持allowJs,但很快就会支持。这是GitHub上的一个分支,表明他们已经添加了它,但它们还没有合并。

答案 1 :(得分:1)

看起来这些选项尚未添加到Atom TypeScript中。看一下他们的界面,它缺少你遇到麻烦的属性。

https://github.com/TypeStrong/atom-typescript/blob/e2fa67c4715189b71430f766ed9a92d9fb3255f9/lib/main/tsconfig/tsconfig.ts#L8-L35

 #include <fstream>
 #include <iostream>
 using namespace std;
 int main()
 {
    ifstream class_details("classlist.txt");
    if (!class_details.is_open())
    {
        cout<< "error"<<'\n';
        return;
    }
    string data;
    % From here I am thinking on how to get the data after first whitespace            
    % in each line
    class_details.close();
    return 0;
    }