【发布时间】:2016-08-12 01:20:00
【问题描述】:
为什么会出现以下屏幕截图中显示的错误?
Atom 说我的 tsconfig.json “项目文件包含无效选项”,用于 allowJs、buildOnSave 和 compileOnSave。
但应该允许这些设置:https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md
【问题讨论】:
为什么会出现以下屏幕截图中显示的错误?
Atom 说我的 tsconfig.json “项目文件包含无效选项”,用于 allowJs、buildOnSave 和 compileOnSave。
但应该允许这些设置:https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md
【问题讨论】:
compileOnSave 和 buildOnSave 不属于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上的一个分支,显示他们已经添加了,只是还没有合并。
【讨论】:
看起来这些选项尚未添加到 Atom TypeScript 中。看看他们的界面,它缺少您遇到问题的属性。
interface CompilerOptions {
allowNonTsExtensions?: boolean;
charset?: string;
codepage?: number;
declaration?: boolean;
diagnostics?: boolean;
emitBOM?: boolean;
help?: boolean;
locale?: string;
mapRoot?: string; // Optionally Specifies the location where debugger should locate map files after deployment
module?: string; //'amd'|'commonjs' (default)
noEmitOnError?: boolean;
noErrorTruncation?: boolean;
noImplicitAny?: boolean; // Error on inferred `any` type
noLib?: boolean;
noLibCheck?: boolean;
noResolve?: boolean;
out?: string;
outDir?: string; // Redirect output structure to this directory
preserveConstEnums?: boolean;
removeComments?: boolean; // Do not emit comments in output
sourceMap?: boolean; // Generates SourceMaps (.map files)
sourceRoot?: string; // Optionally specifies the location where debugger should locate TypeScript source files after deployment
suppressImplicitAnyIndexErrors?: boolean;
target?: string; // 'es3'|'es5' (default)|'es6'
version?: boolean;
watch?: boolean;
}
【讨论】: