TypeScript: error TS2300: Duplicate identifier 'Foo'.
The same name is declared twice in the same scope (or in merged global declarations).
error TS2300: Duplicate identifier 'Foo'.TS2300: Duplicate identifierDuplicate identifier 'Promise'. ts(2300)error TS2300: Duplicate identifier 'require' Meaning
Rename or remove one declaration. In projects it often means two copies of type definitions (@types/node twice, lib.dom plus another DOM typing), or files being both included and re-declared. Check include/exclude and duplicated @types packages.
Common causes
- Two declarations with the same name (not merge-compatible)
- Duplicate
@typesversions in node_modules - Same file included twice
- Global script files redeclaring types
- Copy-paste
⚡ Quick fix
- Rename/remove the duplicate
npm ls @types/nodeand dedupe- Convert global scripts to modules with
export {}
Detailed fix by platform
Linux
npm ls @types/node @types/react && npm dedupe
How to diagnose
- Names — Duplicate where?
- Types — Duplicate packages?
- Files — Modules?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Cannot find module './App.vue' or its corresponding type declarations TypeScript: error TS2307: Cannot find module './App.vue' or its corresponding type declarations.
- TS1005: ';' expected / ',' expected (syntax error) TypeScript: error TS1005: ';' expected.
- TS1128: Declaration or statement expected TypeScript: error TS1128: Declaration or statement expected.
Most viewed in TypeScript
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026