错误TS6200:以下标识符的定义与另一个文件(@ types/jasmine)中的标识符冲突 [英] error TS6200: Definitions of the following identifiers conflict with those in another file (@types/jasmine)

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

问题描述

尝试使用Angular CLI构建项目时收到以下错误

I am receiving the following error when attempting to build my project (using Angular CLI)

ERROR in ../my-app/node_modules/@types/jasmine/index.d.ts(18,1): error TS6200: Definitions of the following identifiers conflict with those in another file: Expected, SpyObjMethodNames, clock, CustomEqualityTester, CustomMatcherFactory, ExpectationFailed, SpecFunction, SpyObj, jasmine

我正在使用VSCode,当我转到有问题的行时,可以选择查看与该文件冲突的文件.

I am using VSCode, and when I go to the line in question, I have the option to view the file it says its conflicting with.

这会将我带到以下位置的文件:

This takes me to a file at the following location:

/Users/<user_name>/Library/Caches/typescript/3.3/node_modules/@types/jasmine/ts3.1/index.d.ts

我有点不明白为什么TS编译器试图使用此缓存的类型定义,这里可能会发生什么?

I'm a little lost to understand why the TS compiler is trying to use this cached type definition, what could be going on here?

谢谢

推荐答案

在这里回答了相同的问题:

Just answered the same question here: Definitions of identifiers conflict with those in another file

再次发布.

检查tsconfig.spec.json中的types小节,很可能它具有类似的内容

Check types subsection in your tsconfig.spec.json, most probably it has something like that

"types": [
  "jasmine",
  "node"
]

我删除了jasmine,所以我的types部分如下所示:

I removed jasmine so my types section looks like that:

"types": [
  "node"
]

它有帮助.

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

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