标识符的定义与另一个文件中的标识符冲突 [英] Definitions of identifiers conflict with those in another file

查看:353
本文介绍了标识符的定义与另一个文件中的标识符冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Typescript 6中的旧组件更新为8.我已经将package.json中的Jasmine依赖项更新,但是现在我遇到了错误:

I'm updating an old component from Typescript 6 to 8. I've updated the Jasmine dependencies in the package.json, but now I'm getting an error:

以下标识符的定义与另一个文件中的标识符冲突:

"Definitions of the following identifiers conflict with those in another file:

ImplementationCallback,ExpectedRecursive,Expected, SpyObjMethodNames,CustomEqualityTester,CustomMatcherFactory, ExpectationFailed,SpecFunction,SpyObj,茉莉花".

ImplementationCallback, ExpectedRecursive, Expected, SpyObjMethodNames, CustomEqualityTester, CustomMatcherFactory, ExpectationFailed, SpecFunction, SpyObj, jasmine".

以下两个冲突文件:

@types/jasmine/index.d.ts

@types/jasmine/ts3.1/index.d.ts

我已经尝试删除缓存以及删除node_modules和package-lock,然后重新安装所有内容.我尝试删除任何一个文件,并将另一个文件用作唯一的index.d.ts文件,但是随后出现错误找不到'茉莉花'的类型定义文件."

I've already tried deleting the cache as well as deleting node_modules and package-lock then reinstalling everything. I've tried deleting either file and using the other as the only index.d.ts file, but then I get the error "Cannot find type definition file for 'jasmine'."

还有其他建议吗?

推荐答案

我实际上是将有角度的6应用迁移到有角度的8,并且遇到了与此处所述相同的问题.我找到了适合我的替代解决方案.

I'm actually migrating an angular 6 app to angular 8 and have encounter the same problem as described here. I have found an alternative solution that works for me.

将此标志添加到tsconfig.json对我有用:

Adding this flag to tsconfig.json did the trick for me:

"skipLibCheck":是

"skipLibCheck": true

文档阅读所有声明文件(* .d.ts)的跳过类型检查".对此一点都不满意,但是当我完成所有与代码相关的事物的迁移时,它仍然有效.

The documentation reads "Skip type checking of all declaration files (*.d.ts)." Not happy with it at all, but it works while I finish the migration of all code related things.

希望有帮助.

这篇关于标识符的定义与另一个文件中的标识符冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆