I wrote a Flappy Bird game in TypeScript's type system(zackoverflow.dev) |
I wrote a Flappy Bird game in TypeScript's type system(zackoverflow.dev) |
If you don't know, Typescript's type annotations are Turing complete, allowing you to compute anything with some clever type trickery.
In order to render graphics from Typescript's types, I ended up creating a compiler that compiles Typescript's types into bytecode, and a custom VM that can execute that bytecode.
Each frame, the VM takes draw commands from type-level Typescript, and renders it using the configured graphics backend. It can run in the browser by compiling the VM to Wasm and using the web's Canvas API.