Skip to content
Latchkey

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

  1. Find duplicate @types in the tree and dedupe to one version
shell
npm ls @types/node

Scope the included types

  1. Pin compilerOptions.types to only the packages you need
  2. 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →