TypeScript · Compiler and project settings

lib

Declares the built-in APIs available. Without DOM, document and window are unknown to the compiler.

Syntax
"lib": ["ES2022", "DOM"]

Example

Example
{
  "compilerOptions": {
    "lib": ["ES2022", "DOM", "DOM.Iterable"]
  }
}

More in this group

exactOptionalPropertyTypes include / exclude moduleResolution noEmit noUncheckedIndexedAccess paths skipLibCheck strict

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course