lib (compiler option)

The compiler option that lists which built-in type declarations are available, such as ES2022 features or browser DOM types.

In more detail

lib only affects type checking: it tells the compiler which built-in objects and methods exist in your runtime. A Node.js project usually lists only an ECMAScript edition, while a browser project adds DOM. If lib is not set, it follows the target option.

Example

"lib": ["ES2022"]

Related terms

Taught in

References