tsc不排除npm链接的节点模块

问题描述 投票:0回答:1

问题:使用tsc类型检查我的应用程序时,出现npm link ed模块错误。

这是我的类型检查命令:"type-check": "tsc --noEmit -p tsconfig.json"

这是我的tsconfig.json

{
    "compilerOptions": {
        "outDir": "./dist/",
        "sourceMap": true,
        "noImplicitAny": false,
        "allowJs": true,
        "module": "commonjs",
        "target": "es6",
        "jsx": "react",
        "esModuleInterop": true,
        "experimentalDecorators": true,
        "skipLibCheck": true
        //"importsNotUsedAsValues": "error"
    },
    "exclude": ["./node_modules/*"] // I've also tried node_modules, /node_modules, node_modules/
}

该命令将由于通过npm链接连接的我的一个node_modules中的类型错误而失败。

从类型检查中排除此模块的任何方法


编辑:

例如,我也尝试使用双星(**

"exclude": ["./node_modules/**/*"]

这给了我同样的错误结果。

typescript npm symlink
1个回答
0
投票

[根据我的经验,npm/yarn link效果不佳。某些东西总是坏掉的:webpack或TypeScript或链接的软件包仅需要一个构建步骤,如今,它们几乎都已完成。

检查relative-deps,旨在解决此问题。

© www.soinside.com 2019 - 2024. All rights reserved.