jasmine、jasminewd2、mocha 的打字稿库中的重复@types(index.d.ts - 重复标识符)

Duplicated @types in typescript libs (index.d.ts - Duplicate identifier) for jasmine, jasminewd2, mocha

我的 Angular 项目中有 jasminejasminewd2mocha。这些库有 index.d.ts 个似乎重复的文件。有什么办法可以避免这个错误吗?因为我的 Visual Studio 无法构建它。我已经尝试在我的 tsconfig.json 文件中排除这些文件,升级版本也无济于事。

6>C:\GIT\proj\node_modules\@types\jasmine\index.d.ts(20,18): error TS2300: Build:Duplicate identifier 'describe'.
6>C:\GIT\proj\node_modules\@types\jasmine\index.d.ts(22,18): error TS2300: Build:Duplicate identifier 'xdescribe'.
6>C:\GIT\proj\node_modules\@types\jasmine\index.d.ts(31,18): error TS2300: Build:Duplicate identifier 'it'.
6>C:\GIT\proj\node_modules\@types\jasmine\index.d.ts(41,18): error TS2300: Build:Duplicate identifier 'xit'.
6>C:\GIT\proj\node_modules\@types\jasminewd2\index.d.ts(10,18): error TS2300: Build:Duplicate identifier 'it'.
6>C:\GIT\proj\node_modules\@types\jasminewd2\index.d.ts(12,18): error TS2300: Build:Duplicate identifier 'xit'.
6>C:\GIT\proj\node_modules\@types\mocha\index.d.ts(36,13): error TS2300: Build:Duplicate identifier 'describe'.
6>C:\GIT\proj\node_modules\@types\mocha\index.d.ts(37,13): error TS2300: Build:Duplicate identifier 'xdescribe'.
6>C:\GIT\proj\node_modules\@types\mocha\index.d.ts(42,13): error TS2300: Build:Duplicate identifier 'it'.
6>C:\GIT\proj\node_modules\@types\mocha\index.d.ts(43,13): error TS2300: Build:Duplicate identifier 'xit'.
6>C:\GIT\proj\node_modules\@types\jasmine\index.d.ts(20,18): error TS2300: Build:Duplicate identifier 'describe'.
6>C:\GIT\proj\node_modules\@types\jasmine\index.d.ts(22,18): error TS2300: Build:Duplicate identifier 'xdescribe'.
6>C:\GIT\proj\node_modules\@types\jasmine\index.d.ts(31,18): error TS2300: Build:Duplicate identifier 'it'.
6>C:\GIT\proj\node_modules\@types\jasmine\index.d.ts(41,18): error TS2300: Build:Duplicate identifier 'xit'.
6>C:\GIT\proj\node_modules\@types\jasminewd2\index.d.ts(10,18): error TS2300: Build:Duplicate identifier 'it'.
6>C:\GIT\proj\node_modules\@types\jasminewd2\index.d.ts(12,18): error TS2300: Build:Duplicate identifier 'xit'.
6>C:\GIT\proj\node_modules\@types\mocha\index.d.ts(36,13): error TS2300: Build:Duplicate identifier 'describe'.
6>C:\GIT\proj\node_modules\@types\mocha\index.d.ts(37,13): error TS2300: Build:Duplicate identifier 'xdescribe'.
6>C:\GIT\proj\node_modules\@types\mocha\index.d.ts(42,13): error TS2300: Build:Duplicate identifier 'it'.
6>C:\GIT\proj\node_modules\@types\mocha\index.d.ts(43,13): error TS2300: Build:Duplicate identifier 'xit'.

多亏了 JimiPajala,我们有了解决方案。

我已将 "skipLibCheck": true, 添加到 tsconfig.json

关于文档: “跳过所有声明文件的类型检查 (.d.ts)。*” https://www.typescriptlang.org/docs/handbook/compiler-options.html