# 03.29.2022 - TypeScript / A note about lib.dom.d.ts

In TypeScript, all the type definitions for the Web API are implemented in the lib.dom.d.ts file.

One interesting thing is, this file is automatically generated from the Web Standards and does not mean to be edited by hand.

The w3c/webref project generates the machine-readable version of the Web Standards. New data is generated every 6 hours.

The microsoft/TypeScript-DOM-lib-generator project pulls the machine-readable webref and uses it as a reference data to generate the TypeScript interface for every Web API. The output is the generated lib.dom.d.ts, which will be used in TypeScript.

In this repository, we can modify the behavior of the generator like:

When the npm run build command is triggered, the src/build.ts script will pull the interfaces from webref and check the inputfiles/removedTypes.jsonc to see if there is any types needed to be removed, then it checks the addedTypes.jsonc and overridingTypes.jsonc to modify the remaining interfaces accordingly.
Finally, the lib.dom.d.ts will be generated to be submitted to the TypeScript repository.