.d.ts files and @types — type definitions for JavaScript libraries, ambient declarations, and module augmentation.
Five passes over the same idea, each from a different angle. Do them in order, or jump to whichever you need.
Declaration files (.d.ts) provide type information for JavaScript code. DefinitelyTyped (@types/*) provides community-maintained definitions. Key concepts: ambient declarations (declare), module augmentation, triple-slash directives, and generating declarations with tsc --declaration. Understanding .d.ts is essential for library authors.