Porting Doom to Typescript Types took 3.5 trillion lines, 90GB of RAM and a full year of work

Doom key artwork with the lettering "Typescript Types".
(Image credit: YouTube: Michigan Typescript)

Doom has been ported to just about everything, right? Well, until now, the id Software title had not been recreated inside of Typescript's Types system, until now.

The feat was devised by Software Engineer Dimitri Mitropoulos, founder of Michigan Typescript and co-founder of SquiggleConf. He released a video showcasing the results of a year-long effort to get the game running inside of Typescript's Types system.

Typescript is a language built on top of Javascript, that add static typing to catch many errant mistakes before your executes, think of it as guardrails which check that functions and other variables are being used correctly. While this is commonly used in all kinds of development, it's unheard of to run a game within Typescript's Type system.

The port itself runs inside three and a half trillion lines of types, totalling a gargantuan size of 177 TB. This is run through Typescript's Type tracker, which takes 12 days to compile the first frame of Doom (0.0000009645 fps). This meant that 20 million type instantiations were running every second in order to get the output.

Mitropoulos explained in the Michigan TypeScript Discord server that this could be improved to take "1 to 12 hours", as long as someone works on it, with the developer noting that he has notes for where potential performance optimizations could be made.

This was done by running the project within a custom WASM runtime, which is then processed through Typescript within an editor to display a frame.

TypeScript types can run DOOM - YouTube TypeScript types can run DOOM - YouTube
Watch On

Mitropoulos explains that the project was a year-long struggle, due to having to write his own tools, including 12,364 handwritten tests, learning C, C++, WebAssembly, and other languages.

"I did develop what I believe to be the largest Typescript codebase ever", the author explained. Before optimization, he calculated that the project could take up to 1.25 Petabytes of data, with the first frame compiling after three months of continuous type instantiation.

Every type within the project was thousands of lines long, and the project involved developing a virtual machine inside of the Types system, complete with elements like RAM and Disk Space. "The computer is made of Typescript Types that serve as logical implementations of all 116 WebAssembly instructions Doom needs to run."

Mitropoulos further explained that each value within the Typescript Types system equates to a line of pixels, totalling 128,000 lines of pixels in total, resulting in a "resolution" of 320x200, displayed in ASCII.

To do this, the developer needed to remove limitations within the Typescript compiler itself, highlighting just how large the project got, with the Type tracker runtime consuming over 90 GB of RAM while it was running.

This huge overhead meant that common tools within Typescript could not be used, which meant that the herculean task of encoding every element of Doom in types. This required learning to develop elements like an L1 CPU cache, within Typescript Types itself. Due to Typescript requiring iteration on a single string from the left-hand side, binary algorithms had to be input in reverse.

"Oh, and AI can't help" Mitropoulos added, describing that the work was so low level that AI couldn't possibly assist with any of the tasks. Too bad, Grok 3.

Mitropoulos said that he undertook the challenge after completing "every other" Types challenge, and wanted to understand why Doom wouldn't be able to run within Types. However, he managed to find "ridiculous" workarounds to make it all work, despite his own disbelief in the project.

Mitropoulos is preparing two separate videos going into detail on why he created the project, in addition to another video with a technical breakdown of the feat. But for now, the gargantuan project is complete, and Doom has successfully been ported to yet another platform.

Sayem Ahmed
Subscription Editor

Sayem Ahmed is the Subscription Editor at Tom's Hardware. He covers a broad range of deep dives into hardware both new and old, including the CPUs, GPUs, and everything else that uses a semiconductor.

Read more
Wojciech Graj ported Doom to Word
Doom ported to a standalone Microsoft Word document — plays well but there's no sound
DoomPDF port from Ading2210
Doom ported to run directly from a PDF file — DoomPDF port runs at approximately 12.5 FPS
John Carmack
In 1991, after a 28-hour coding spree, the efforts of John Carmack 'Doomed' us all
running Doom on an Apple dongle
Doom runs on an Apple Lightning to HDMI dongle — SoC inside adapter has enough power for smooth gameplay
Screenshot of donno2048's Snake for DOS port being played within a web DOSBox session.
Snake game port is only 56 bytes big and and fits in a QR code
Official screenshot of Doom: The Dark Ages.
The new Doom's RT system requirements may ignite The Dark Ages for your wallet
Latest in Video Games
The Playstacean
The 'Playstacean' is a crab-u-lous PS One mod
Atari parts and accessories store Best Electronics
U.S. Atari parts store still open after 41 years, has spent $100K+ designing new parts — last original Atari hardware launched 32 years ago
SNES console and CRT TV
SNES consoles appear to run faster with age — APU frequency increased by up to 182 Hz after 35 years
An image of Minecraft with Xbox's Copilot for Gaming overlaid. An AI assistant explains through text how to use Minecraft's crafting feature.
Xbox announces 'Copilot for Gaming' AI assistant — early access coming to Xbox mobile app, more details to come at GDC 2025
ROG Ally
Asus rumored to launch Xbox handheld in 2025 — OEM working with Microsoft to 'unify' Windows and Xbox libraries
Control Ultimate Edition
Control Ultimate gets DLSS 3.7 support and new 'Ultra' settings — cuts performance nearly in half
Latest in News
Qualcomm
Qualcomm launches global antitrust campaign against Arm — accuses Arm of restricting access to technology
Nvidia Ada Lovelace and GeForce RTX 40-Series
Analyst claims Nvidia's gaming GPUs could use Intel Foundry's 18A node in the future
RX 9070 XT Sapphire
Lisa Su says Radeon RX 9070-series GPU sales are 10X higher than its predecessors — for the first week of availability
RTX 5070, RX 9070 XT, Arc B580
Real-world GPU prices cost up to twice the MSRP — a look at current FPS per dollar values
Zotac Gaming GeForce RTX 5090 AMP Extreme Infinity
Zotac raises RTX 5090 prices by 20% and seemingly eliminates MSRP models
ASRock fixes AM5 motherboard by cleaning it
ASRock claims to fix 'burned out' AM5 motherboard by cleaning the socket
  • oe--
    I was reluctant learning Typescript. Now I know I should stay away from it😅
    Reply
  • john_kk
    Absolute madman, so much work for a meme, someone give this guy a job in R&D
    Reply