TypeScript Concepts

Declaration merging — combined named declarations

Compatible interface declarations in the same scope contribute members to one interface. Duplicate non-function members must agree in type, while overload members follow their own rules. Other supported merging forms include certain namespace combinations. An interface merge is not a runtime object merge, and type aliases cannot be reopened this way. Observed output: '2 ready'. Local example verified with TypeScript 5.8.3, strict checking, ES2022/CommonJS and Node.js 22.16.0; declarations enabled.

Formal Syntax & Structure

typescript syntaxtypescript
interface Options { id: number } interface Options { label: string }

Working Example

Example Snippettypescript
interface Options { id: number }interface Options { label: string }const item: Options = { id: 2, label: "ready" };console.log(item.id, item.label);
TypeScript Reference