Skip to content
TypeScript·Advanced·Coding·1 min read

Can two interfaces with the same name in the same scope coexist?

Short interview answer

Yes — this is declaration merging. TypeScript combines their members into a single interface. Two type aliases with the same name in the same scope, by contrast, produce a compile error because type aliases can't be merged.

Example

TypeScript
interface Window { myGlobal: string; }  // merges with the built-in Window// type Window = { ... }  // Error: Duplicate identifier

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Utility types and type vs. interface

Related questions