0Pricing
TypeScript Academy · Lesson

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

  1. ES Modules (named vs default), re-exports
  2. Ambient declarations (.d.ts) & third-party typings
  3. Path mapping & module resolution
← Back to TypeScript Academy