Edge Computing with Cloudflare Workers
Improving Workers TypeScript support: accuracy, ergonomics and interoperability

Improving Workers TypeScript support: accuracy, ergonomics and interoperability

11/18/2022 · Brendan Coll

What this post added

This post details significant improvements to the automatic generation of TypeScript types for the Cloudflare Workers runtime. Key advancements include: rebuilding generation scripts using `workerd`'s RTTI system for greater accuracy and maintainability, open-sourcing these scripts, introducing separate type versions for improved interoperability with browser/standard types, enabling selection of types based on compatibility dates, automating the generation of ambient types from `wrangler.toml` for bindings and module rules, and integrating documentation and changelogs directly into the types. The system also allows for handwritten overrides to enhance type fidelity, such as adding generics, specifying method overloads, and renaming types.

Read the original post ↗