Ambient declarations (.d.ts) & third-party typings
Write ambient declarations in .d.ts files to describe globals and modules; install and use third‑party typings safely.
Intro
Goal: Describe external JavaScript with ambient declarations in .d.ts files and use third‑party typings for libraries that lack types.
Global declarations
globals.d.ts: Declare globals and extend ambient interfaces (e.g., Window) without emitting JS.
// file: globals.d.ts
// Declare global variables and interfaces
declare const VERSION: string;
declare interface Window {
appReady?: boolean;
}All lessons in this course
- ES Modules (named vs default), re-exports
- Ambient declarations (.d.ts) & third-party typings
- Path mapping & module resolution