I'm running angular 1.5 with typescript (yay), and we include both @types/angular
and @types/angular-mocks
.
The trouble is that @types/angular-mocks
lists @types/angular
as a dependency with * versioning. This causes yarn to install 1.6 in @types/angular-mocks/node_modules
.
The final result is a ts compile error: @types/angular
1.5 has a different definition for $inject than @types/angular
1.6
How can I get the tsconfig to ignore @types/angular-mocks/node_modules
?
Here is my current 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"
]
}
来源:https://stackoverflow.com/questions/48427807/tsconfig-how-to-ignore-types-whatever-node-modules-for-a-specific-directory