我使用打字稿(yay)运行角度1.5,我们同时包含@types/angular
和@types/angular-mocks
。
问题是@types/angular-mocks
列出@types/angular
作为*版本的依赖项。这会导致纱线在@types/angular-mocks/node_modules
中安装1.6。
最终结果是ts编译错误:@types/angular
1.5对$ inject的定义与@types/angular
1.6不同
如何让tsconfig忽略@types/angular-mocks/node_modules
?
这是我目前的tsconfig:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"lib": [
"es2016",
"dom"
],
"rootDir": "app/modules",
"mapRoot": "/modules/",
"sourceRoot": "/modules",
"typeRoots": ["./node_modules/@types"],
"baseUrl": ".",
"paths": {
"*": [
"app/modules/*"
]
}
},
"include": [
"./node_modules/@types",
"./typings-custom/*.d.ts"
],
"exclude": [
"node_modules"
]
}