Skip to content

Code Generation

The repository contains a modified TypeScript-DOM-lib-generator under tools/TypeScript-DOM-lib-generator. Generated output is a starting point, not the complete source of truth: checked-in bindings are reviewed and maintained by hand.

Source modules are grouped by API family, while consumers use the flat public WebAPI namespace. For example, the public WebAPI.Fetch functions are maintained in src/fetch/Fetch.res:

external fetch: (string, ~init: Request.requestInit=?) => promise<Response.t> = "fetch"
external fetchWithRequest: (Request.t, ~init: Request.requestInit=?) => promise<Response.t> =
"fetch"

The generator may produce numbered overloads or use generated type-holder names. Before committing a binding, use the public owner modules, semantic overload names, accurate native types, and ReScript-facing documentation. Do not hand-edit generated docs/pages/apidocs output; the API pages are generated from the public module sources.

Not every hand-maintained change is reproducibly generated from the current tool. Treat the checked-in source as canonical, and keep generated files and compile-coverage fixtures consistent with the repository’s documented test workflow.