TS2300: Duplicate identifier - in CI
tsc found the same identifier declared more than once in a way that conflicts.
What this error means
Type-checking fails with TS2300 naming the duplicated identifier, frequently from two copies of a @types package.
tsc
node_modules/@types/node/globals.d.ts(72,13): error TS2300: Duplicate identifier 'RequestInit'.Common causes
How to fix it
Deduplicate type packages
- Find duplicate @types in the tree and dedupe to one version
shell
npm ls @types/nodeScope the included types
- Pin compilerOptions.types to only the packages you need
- Adjust lib so it does not duplicate a @types global
tsconfig.json
{
"compilerOptions": {
"types": ["node"]
}
}How to prevent it
- Keep one version of each @types package and use a focused types allowlist to avoid global collisions.