# TypeScript: error TS2300: Duplicate identifier 'Foo'.

**Code:** `TS2300: Duplicate identifier` · **Category:** TypeScript · **Seen on:** TypeScript

The same name is declared twice in the same scope (or in merged global declarations).

## 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 `@types` versions in node_modules
- Same file included twice
- Global script files redeclaring types
- Copy-paste

## Quick fix

1. Rename/remove the duplicate
2. `npm ls @types/node` and dedupe
3. Convert global scripts to modules with `export {}`

## Detailed fix by platform

### Linux

1. `npm ls @types/node @types/react && npm dedupe`

## How to diagnose

1. **Names** — Duplicate where?
2. **Types** — Duplicate packages?
3. **Files** — Modules?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/typescript/ts2300-duplicate-identifier)
