tsconfig - 如何忽略特定目录的@ types / whatever / node_modules?

时间:2018-01-24 16:56:23

标签: angularjs typescript typescript-typings yarnpkg

我使用打字稿(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"
    ]
}

0 个答案:

没有答案