declaration merging

TypeScript combining several declarations with the same name, such as two interface blocks, into one type.

In more detail

It is how you add fields to a type you do not own, for example adding user to a framework's Request interface or DATABASE_URL to ProcessEnv. It works for interfaces and namespaces but not for type aliases.

Related terms

Taught in

References