"Ambient declarations describe something that exists, somewhere, without TypeScript knowing how."
What ambient means
'Ambient' is TypeScript's term for declarations that describe types without providing implementations. They tell the compiler 'this name exists and has this type; trust me on how it gets there.' The .d.ts files we covered are mostly composed of ambient declarations.
declare module — three forms
1. Standalone module declaration: declare module 'foo' in a .d.ts describes a module that's importable by name. We covered this in the previous lesson.
2. Wildcard module declarations: declare module '*.css' tells the compiler that any import ending in .css is fine and has a particular shape. Common pattern for CSS-modules or asset imports in bundler-based projects.
3. Augmenting existing modules: declare module 'react' { interface HTMLAttributes { custom: string } } adds a property to an existing module's interface. This is how library authors let you extend their types from outside.
Augmenting globals
The declare global block lets you augment the global scope. declare global { interface Window { myApp: ... } } adds a property to window everywhere in your project. Combined with interface declaration merging, this is how project-wide global types get added.