Just recently addressed a similar query on this topic at: error TS6200: Definitions of the following identifiers conflict with those in another file (@types/jasmine)
Reposting it here for reference. Feel free to suggest any improvements if needed.
Encountering identical issues during the transition from Angular 6.x to 8.x (typescript 3.5+), specifically dealing with conflicting @types/jasmine type files (index.d.ts & 3.1/index.d.ts), I managed to resolve the matter through the following method:
Brief Summary
- Eliminated @types/jasmine from package.json and instead incorporated its 3.1/index.d.ts as a static file within my source code.
- Given that @types/jasminewd2 depends on @types/jasmine, I also removed this library from package.json and included it as a static file.
- Adjusted certain configuration files to acknowledge the static type files.
- Reinstalled libraries
Detailed Steps
1. Removal:
Deleted entries from package.json
"devDependencies": {
...
"@types/jasmine": "3.4.0",
"@types/jasminewd2": "2.0.6",
...
}
2. Inclusion:
Added folders & files to directory structure beneath 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. Configuration Updates:
tsconfig.json (where XXX corresponds to your folder structure)
...
"typeRoots": [
...
"src/ XXX /@types"
]
...
tsconfig.spec.json
...
"types": [
...
"jasminewd2"
]
...
4. Library Reinstallment
Execute npm install
Retroactive Handling of Conflicts
- Reverse the above steps
- Reinstall packages using
npm install @types/jasmine --save-dev
npm install @types/jasminewd2 --save-dev
Additional Insights
Upon scouring the web, only a couple of similar grievances were found, leading to the hypothesis that the provided solution serves as a temporary remedy, hinting at a potential underlying issue in the Angular project's configuration. This could potentially result in the inability to differentiate between "using typescript below 3.1" and "using typescript from 3.1 onwards" within @types/jasmine.
- error TS6200: Definitions of the following identifiers conflict with those in another file (@types/jasmine)
- Definitions of identifiers conflict with those in another file