Automatically generating types for Cloudflare Workers
Nov 16, 2021Brendan Coll, Jonathan Kuperman

Summary
This post details the automation of type generation for Cloudflare Workers, specifically for Rust and TypeScript. An internship project developed a pipeline that runs during Workers runtime builds to generate accurate and up-to-date types. This pipeline creates TypeScript and Rust types, as well as an intermediate JSON representation, ensuring consistency and enabling other language ecosystems to generate their own types. Overrides are used for concepts like generics and function overloads not directly supported by the C++ runtime.