global augmentation
Adding types to global objects such as Window or NodeJS.ProcessEnv with a declare global { } block inside a module.
In more detail
The course uses it to type environment variables like DATABASE_URL. Keep such additions few, because everything global is visible to every file.
Related terms
- module augmentation — Adding types to another package from your own code with declare module "name" { } and declaration merging.
- process.env — The object in Node.js that holds the process's environment variables, with every value stored as a string.
- Window — The global object in a browser page, representing the browser tab, which holds globals such as document, location, setTimeout and fetch.
- ambient declaration — A declaration starting with declare, which tells the compiler something exists at run time without generating any code for it.
Taught in
- Declaration Files, Ambient Namespaces And Module Augmentation — Production TypeScript