Inheritance 打字脚本2.1+;tsconfig扩展
目前,我正在尝试tsconfig.json中的新扩展功能,它允许开发人员拥有一个基本的tsconfig.json,其他模块可以扩展/修改它 它正在发挥作用,尽管不如预期的那样。不知何故,要使其正常工作,唯一的方法是在父配置和子配置中指定compileroptions.lib parent.tsconfig.jsonInheritance 打字脚本2.1+;tsconfig扩展,inheritance,typescript,tsconfig,Inheritance,Typescript,Tsconfig,目前,我正在尝试tsconfig.json中的新扩展功能,它允许开发人员拥有一个基本的tsconfig.json,其他模块可以扩展/修改它 它正在发挥作用,尽管不如预期的那样。不知何故,要使其正常工作,唯一的方法是在父配置和子配置中指定compileroptions.lib parent.tsconfig.json { "compilerOptions": { "target": "es5", "module": "commonjs", "moduleResolut
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"lib": [ // Lib compiler options defined!!!
"dom",
"es6"
]
},
"exclude": [
"node_modules"
],
"awesomeTypescriptLoaderOptions": {
"resolveGlobs": true,
"forkChecker": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
child.tsconfig.json(预期)
child.tsconfig.json(需要工作)
请就此事提出一些建议
干杯你做的一切都对。您的
tsconfig.json
文件应该位于当前项目的根目录中。仔细检查parent.tsconfig.json
文件的路径是否在child.tsconfig.json
sourcemap等文件中正确设置,似乎对我也不起作用,在使用tsc时没有明显的错误,但VS 2015也强烈抱怨缺少模块和目标。这很奇怪,它对我们有效。我已经看过代码()因为我们也有同样的问题。它看起来应该可以工作,因为它从继承的选项复制tsconfig编译器选项(由hasOwnProperty确定)中没有的任何内容。
{
"extends": "../parent.tsconfig.json",
}
{
"extends": "../parent.tsconfig.json",
"compilerOptions": {
"lib": [ //Have to specify lib again ==> Double-u-t-f
"dom",
"es6"
]
}
}