Yellow marks are automatic key passages. They aren’t personal saved highlights. Select a timestamp to follow along with the video.
Doom was implemented and run entirely in TypeScript’s type system, using a virtual machine built from scratch to execute all 116 WebAssembly instructions the game requires. The project took a year of intense work, custom tooling, thousands of tests, and major compiler-limit changes; its type checker processed 177 terabytes of types over 12 days to render the first 320-by-200 frame. Along the way, the system had to model Doom’s memory, control flow, graphics, sound, and gameplay, while extreme resource demands and fragile tooling made debugging difficult. What began as an attempt to find a reason Doom could not run this way became a working demonstration of the type system’s limits, with follow-up technical explanations planned.
Doom in TypeScript’s type system
Doom, the 1993 video game, ran entirely in TypeScript’s type system. More than 3.5 trillion lines of types, totaling 177 terabytes, were processed around the clock for 12 days to produce the first frame. Reaching that point took a brutal year of 18-hour workdays. At the outset, less than 10% of the knowledge needed was in hand; the project proved far harder than expected, with no comparable example to follow. The necessary tools had to be built from scratch, 12,364 tests were written, and several programming languages had to be learned along the way.
Building a virtual machine from types
The result was a WebAssembly virtual machine built entirely from TypeScript types, capable of running other programs too. There were no shortcuts, tricks, or other execution languages—only types. For comparison, the Node.js types package is one of the largest in DefinitelyTyped; even all packages in DefinitelyTyped combined are small beside the types required to run Doom.
The project was not an attempt to find a new way to play Doom. After 300 videos solving type challenges, the goal was to find a simple reason the feat could not be done. The creator describes being more a “master of close nsmh” than a polished 10x developer, but the reactions made the effort worthwhile: viewers were astonished to see Doom running in a type system.
Scale and audience reaction
The creator believes the project may be the largest TypeScript codebase ever made. Early estimates suggested that the computer would need to process 1.25 petabytes of TypeScript types for more than three months. Extreme optimizations reduced the work to 177 terabytes and 12 days of continuous TypeScript compiler runs to start the game and render its first frame. Each individual TypeScript type was hundreds of thousands of lines long.
Reactions ranged from “Why would you do this?” to “genuinely shocking,” “mindblowing,” and “quite impressive.” Two follow-up videos were planned to answer the many questions. The first, about an hour and a half long, covers what motivated the attempt in a condensed, year-long-vlog format, including technical concepts at a high level and the many unknowns encountered. The second is highly technical and was expected to be at least two hours long, with a live YouTube stream for questions. Viewers could submit questions in the video comments or on the Doom channel in Discord.
How the type-level computer works
The project built an isolated computer from scratch within TypeScript’s type system. It includes RAM, disk space, a call stack, subroutines, memory pointers, execution context, and custom tooling. Its TypeScript types implement all 116 WebAssembly instructions needed to run Doom. The game logic amounts to 18 million instructions, evaluated one by one by the type checker, each corresponding to a distinct machine state.
A typical TypeScript check involves 200,000 to 500,000 type instantiations. This system sustained 20 million instantiations per second for 12 days. The final output is a TypeScript object containing one value per pixel: 128,000 pixels for a 320-by-200 frame. Keyboard input can also control the game. The finished project is vanilla TypeScript that others can run, but development required temporarily removing compiler safeguards.
Removing compiler limits
During development, the TypeScript compiler was modified to remove limits on excessive stack depth while comparing types, deeply nested or potentially infinite type instantiations, union and tuple size, output truncation, and recursion. The computer’s own stack limit also had to be raised. With these protections disabled, the type checker could consume 100 GB of memory.
That freedom made experimentation possible, but left no room for mistakes. Available stack traces were enormous, and more often the system simply froze. Even a minor typo in an import could trigger an infinite loop, exhaust heap memory, and crash the process. Syntax highlighting was about the only tool that barely worked, partly because files could reach 1 GB—far beyond Prettier’s capacity. Language-server integrations and linters crashed immediately.
Despite starting with little knowledge of compilers or virtual-machine internals, six months of work got smaller C programs running. Doom demanded much more: every game component had to be representable as types, including maps, textures, sprites, sounds, enemy AI, weapons, items, physics, audio, text, and everything else.
Implementing Doom’s internals
Making the game work required building a type-level garbage collector, an L1 CPU cache, runtime dead-code elimination, a real-time memory compactor, and a global value stack with depth counting to prevent stack underflow. The system also needed dynamic dispatch tables, module-level global variables, and labeled gotos, which made control flow a major challenge. Linear RAM was represented as a huge, unsortable object with 32-bit address keys and byte values.
A way to pause type evaluation from TypeScript userland enabled full core dumps, type-level exception handling, and runtime stack tracing. Under the hood, the engine uses binary two’s-complement numbers stored in string literals. Since TypeScript only permits iterating through strings from left to right, all binary algorithms had to be implemented in reverse. The engine contains no arrays, objects, strings, or booleans—only binary numbers. Doom uses only 64-bit and 32-bit integers, which are neither signed nor unsigned; figuring that out took a full day. During the project, Josh Goldberg and the creator also started SquiggleConf, a Boston-based cross-language conference for people passionate about dev tools.
Persistence and the original goal
The project continued because success always seemed just around the corner, though that confidence came partly from not knowing better. The goal was never necessarily to run the game; it was to identify the specific reason Doom could not run in a type system. Each roadblock brought another unlikely workaround. The belief that it could not work—and the doubt that belief created—kept the effort going. Even after the game ran, accepting the result was difficult. In retrospect, the project was a case of getting “nerd sniped.”
The achievement was called insane, unlikely to be surpassed in sheer effort or commitment to the joke, and a remarkable dedication to the bit.
Turn your watchlist into a reading routine
Bring your YouTube videos together, read summaries with key passages marked, and explore the full transcript. Save your own highlights with Pro.
Start with 5 free batteries. Each covers up to 30 minutes of a new summary.
New summaries depend on video availability and demand; processing may take time or require retry.