2016-12-12 51 views
2

目前,我正在尝试tsconfig.json中的新扩展功能,该功能允许开发人员拥有基础tsconfig.json,其他模块可以扩展/修改。TypeScript 2.1+ tsconfig扩展

它正在工作,但并不如预期。不知何故,获得这个工作的唯一方法是在父配置和子配置中指定compileroptions.lib。

parent.tsconfig.json

{ 
    "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(预期)

{ 
    "extends": "../parent.tsconfig.json", 
} 

child.tsconfig.json(需要工作)

{ 
    "extends": "../parent.tsconfig.json", 
    "compilerOptions": { 
    "lib": [ //Have to specify lib again ==> Double-u-t-f 
     "dom", 
     "es6" 
    ] 
    } 
} 

有关此事的一些建议将不胜感激。

干杯

+1

sourcemap等等,对于我来说似乎也没什么用,使用TSC时没有明显的错误,但VS 2015对错失模块和目标抱怨很大。 –

+0

这很奇怪,它适合我们 – Shrike

回答

0

你正在做的一切都是正确的。您的tsconfig.json文件应位于当前项目的根目录中。仔细检查您的child.tsconfig.json中是否正确设置了parent.tsconfig.json文件的路径。