TS2300
Duplicate identifier
Duplicate identifier 'Result'.The compiler’s own words. Not translated — this is the string you pasted into a search box.
The same non-mergeable type name was declared twice in one scope.
Reproduction
type Result = { ok: true } type Result = { ok: false }
The build asserts this emits exactly this code.
Why the compiler says this
Type aliases name one definition and do not declaration-merge. Two aliases with the same name leave every use ambiguous about which definition it means, so the duplicate is rejected at both declarations.
Fixes
- 01
type Result = { ok: true } | { ok: false }
Combine alternatives in one alias when they represent branches of the same concept.
- 02
type Success = { ok: true } type Failure = { ok: false } type Result = Success | Failure
Give distinct concepts distinct names, then compose them where needed.
Takeaway
Type aliases do not merge. Rename, remove, or deliberately compose duplicate definitions.
