This page covers the process for requesting or contributing changes to TypeScript's built-in type declaration files (the lib files). These include ECMAScript standard library types, DOM API types, Web Worker API types, and Intl API types. For an overview of how these files are organized and selected at compile time, see Standard Library and ECMAScript Standard Libraries and DOM and Web Worker APIs.
The standard library declarations live in three filesystem locations, each serving a distinct purpose:
| Location | Purpose |
|---|---|
src/lib/ | Authoritative source files — all edits happen here |
built/local/ | Build output — copied from src/lib/ by the build task |
lib/ | Last Known Good (LKG) — used to bootstrap compilation; updated only on release |
Do not edit lib/ directly. The files there are updated by the release process. Build output in built/local/ is regenerated automatically by running hereby CONTRIBUTING.md163-165
Sources: CONTRIBUTING.md154-170 src/lib/README.md1-27
The src/lib/ directory contains two categories of files:
These cover ECMAScript language features and Intl APIs. They can be changed directly by editing the files under src/lib/. Examples:
src/lib/es5.d.tssrc/lib/es2022.array.d.tssrc/lib/esnext.intl.d.tsThese cover the DOM and Web Worker APIs. They must not be edited by hand. They are auto-generated from an external tool.
| File | Content |
|---|---|
src/lib/dom.generated.d.ts | Window/DOM APIs src/lib/dom.generated.d.ts1-10 |
src/lib/webworker.generated.d.ts | Worker APIs src/lib/webworker.generated.d.ts1-10 |
src/lib/dom.iterable.generated.d.ts | Deprecated stub (contents merged into main file) src/lib/dom.iterable.generated.d.ts1-3 |
src/lib/webworker.iterable.generated.d.ts | Deprecated stub (contents merged into main file) src/lib/webworker.iterable.generated.d.ts1-3 |
Sources: CONTRIBUTING.md154-178 src/lib/README.md22-27
Diagram: Lib File Ownership by Domain
Sources: src/lib/README.md5-26 CONTRIBUTING.md173-175
Inclusion criteria differ by domain.
| Domain | Inclusion Criterion |
|---|---|
| ECMAScript / Intl | TC39 proposal at stage 3 or later |
| DOM / Web Worker APIs | API available un-prefixed and unflagged in at least 2 browser engines (not just 2 Chromium-based browsers) |
These thresholds are documented in src/lib/README.md src/lib/README.md11-21
Useful references for determining readiness:
tc39/proposals → finished-proposals.mdtc39/proposals → ecma402/finished-proposals.mdFor hand-edited files, the contribution process follows the standard pull request workflow described in Pull Request Process.
Steps:
src/lib/.hereby to propagate the change to built/local/.main branch.The files in lib/ (LKG) should not be updated. They are only changed as part of the publishing process CONTRIBUTING.md169-171
Diagram: Hand-Edited Lib Change Flow
Sources: CONTRIBUTING.md154-170
The src/lib/dom.generated.d.ts and src/lib/webworker.generated.d.ts files are auto-generated and must not be edited directly in this repository. All changes must go through the TypeScript-DOM-lib-generator repository.
Steps:
microsoft/TypeScript-DOM-lib-generator.*.generated.d.ts files.Diagram: DOM Change Flow
Sources: CONTRIBUTING.md172-175 src/lib/README.md22-27
A GitHub Actions workflow (pr-modified-files.yml) detects when a pull request directly modifies the generated files and automatically closes it with an explanatory message. This applies to:
src/lib/dom.generated.d.tssrc/lib/dom.iterable.generated.d.tssrc/lib/webworker.generated.d.tssrc/lib/webworker.iterable.generated.d.tsThe workflow is defined in .github/workflows/pr-modified-files.yml92-107 It uses the GitHub API to enumerate changed files in the PR and calls gh pr close with a comment directing the contributor to the generator repository.
The GitHub issue template for library changes is defined in .github/ISSUE_TEMPLATE/lib_change.yml .github/ISSUE_TEMPLATE/lib_change.yml1-57 It collects the following fields:
| Field | Purpose |
|---|---|
| Compilation target | e.g., ES2020 |
| Library | Which lib file is affected |
| Missing / Incorrect Definition | The specific API, property, or method |
| Sample Code | TypeScript code that should work but doesn't |
| Documentation Link | MDN, W3C, or ECMAScript spec reference |
Note: The issue template explicitly mentions that the DOM lib (
lib.dom.d.ts) is maintained atmicrosoft/TypeScript-DOM-lib-generator, and reporters can save a step by filing there directly.
Commonly requested but intentionally excluded items include:
Sources: .github/ISSUE_TEMPLATE/lib_change.yml1-57 src/lib/README.md11-21
Sources: CONTRIBUTING.md154-178 src/lib/README.md1-27 .github/ISSUE_TEMPLATE/lib_change.yml1-57 .github/workflows/pr-modified-files.yml92-107
Refresh this wiki
This wiki was recently refreshed. Please wait 4 days to refresh again.