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, jasmine".
The two conflicting files are the following:
@types/jasmine/index.d.ts
@types/jasmine/ts3.1/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'."
Does anyone have any other suggestions?
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.
Adding this flag to tsconfig.json did the trick for me:
"skipLibCheck": true
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.
Hope it helps.
Just answered the same question here: error TS6200: Definitions of the following identifiers conflict with those in another file (@types/jasmine)
Posting it again. If that's wrong, please edit/advice how to do properly
Having had the same problems when migrating from Angular 6.x to 8.x (typescript 3.5+) with both @types/jasmine type-files (index.d.ts & 3.1/index.d.ts) competing with each other i solved it the following way:
1. Removed:
entries from package.json
"devDependencies": {
...
"@types/jasmine": "3.4.0",
"@types/jasminewd2": "2.0.6",
...
}
2. Added instead:
folders & files to file-structure below src-folder
src (folder)
...
@types
jasmine
index.d.ts (from node_modules/@types/jasmine/3.1/index.d.ts)
jasminewd2
index.d.ts (from node_modules/@types/jasminewd2/index.d.ts)
3. Changed configs:
tsconfig.json (where XXX corresponds to your folder-structure)
...
"typeRoots": [
...
"src/ XXX /@types"
]
...
tsconfig.spec.json
...
"types": [
...
"jasminewd2"
]
...
4. Re-install libs
run npm install
npm install @types/jasmine --save-dev
npm install @types/jasminewd2 --save-dev
As searching the internet showed only 2 similar complaints the assumption is close, that the above mentioned solution is a fix only, but there must be a better one (otherwise more people would complain about the problem). it might be that there is an unrecognized error somewhere within the configuration of the angular-project that could lead to a point where a decision between "we're using typescript below 3.1" and "we're using typescript from 3.1 up" isn't possible within @types/jasmine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With