我使用了一个 npm 模块 web3@1.0.0-beta.24,它的 index.d.ts 文件中有一些错误。
我想忽略TS编译器的这个文件(node_modules/web3/index.d.ts),我想使用我自己的类型文件。
但是tsc仍然使用这个错误的文件,无法编译我的项目。
这是我的tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true
},
"exclude": ["node_modules/web3/index.d.ts"]
}
如果我手动删除node_modules/web3/index.d.ts
,tsc 会编译我的项目。
如何为 tsc 排除此文件?
我创建了一个使用最少代码的存储库来重现此问题:https://github.com/serge-nikitin/q1
尝试将此选项添加到 tsconfig.json 以忽略编译时检查的 lib 声明文件。
{
"compilerOptions": {
"skipLibCheck": true
},
}