TypeScript namespace
A TypeScript block, namespace Name { }, that groups declarations under one name and can be merged across files.
In more detail
Modern code uses modules instead, but namespaces are still how some global types are organised, such as NodeJS.ProcessEnv. Declaring namespace Framework twice merges the two, like interfaces.
Related terms
- declaration merging — TypeScript combining several declarations with the same name, such as two interface blocks, into one type.
- global augmentation — Adding types to global objects such as Window or NodeJS.ProcessEnv with a declare global { } block inside a module.
- process.env — The object in Node.js that holds the process's environment variables, with every value stored as a string.
Taught in
- ECMAScript Modules, CJS Interop And verbatimModuleSyntax — Production TypeScript
- Declaration Files, Ambient Namespaces And Module Augmentation — Production TypeScript