如何排除TypeScript编译器的*.d.ts文件?

如何排除TypeScript编译器的*.d.ts文件?,typescript,typescript-typings,Typescript,Typescript Typings,我使用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 }, "e

我使用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\u modules/web3/index.d.ts
,tsc将编译我的项目

如何为tsc排除此文件

我已经创建了一个回购协议,使用最少的代码来重现此问题:

尝试将此选项添加到tsconfig.json以忽略编译时的库声明文件检查

{
  "compilerOptions": {
    "skipLibCheck": true
  },
}

您尝试过通配符吗?“排除”:[“node_modules/web3/*.d.ts”]这种通配符在我使用TypeScript v3.9.9和Win10时不起作用,这不起作用。在生成过程中,我的文件列表中仍然有d.ts文件否,这不是跳过生成d.ts文件,而是跳过类型检查d.ts文件。为我工作,life saver谢谢