TypeScript types can run DOOM [video]
121 comments
·February 26, 2025ravenstine
SXX
By now there is more than one story how some open source developer wasn't hired because their skills with the project they created was not sufficient for the job.
brap
I’m 100% sure that if he was being considered for a domain expert role in some domain related to this (e.g. TypeScript) his score in a typical whiteboard interview wouldn’t have been a deciding factor whatsoever. This is a standard hiring track even in big tech. Sometimes you’ll even be exempt from these interviews altogether.
But if he was being considered for a mid level generalist role, yeah, none of this would’ve mattered. And why should it?
turnsout
> But if he was being considered for a mid level generalist role, yeah, none of this would’ve mattered. And why should it?
As someone who has been on the hiring manager side, I'll state the obvious: because it demonstrates insanely good problem-solving skills that would transfer to nearly any challenge.jf
Would he have made it past your recruiter screen though?
dandsupernig
[flagged]
null
Jasper_
Has anybody ever figured out what "invert a binary tree" means? That came from Max Howell, and nobody else seems to have ever received that question.
The best anyone can figure out is that it's reversing the left and right branches, which seems like it's ten lines of code, at most?
mirekrusin
Maybe the catch was in saying that left right labels are arbitrary, could be called node1 and node2 as well, inverting is not necessary per se, just visit it in node2, node1 order if needs to be flipped - ie. no physical rearrangement is necessary.
Liquix
leetcode seems to agree with your definition [0]. the meme isn't to say that inverting a binary tree is particularly difficult - anyone familiar with coding challenges and trees could trivially produce a solution. the meme is more pointing out how ludicrous it is that senior/staff/principal interviews can hinge on these types of problems, despite the engineer proving their proficiency by doing something like running DOOM in typescript types or writing homebrew [1].
[0] https://leetcode.com/problems/invert-binary-tree/description...
gspencley
> "We've decided to prioritize other candidates, as you are strong in the fundamentals but lack the kind of experience in Vue that we're looking for."
I have a nuanced view of your particular example. I've been in this industry for almost 30 years. I cut my teeth writing C/C++, had an interest in language theory and frameworks and was brought up to care about portability. I always wanted to be able to easily transition from one language to another, or one framework to another.
And I always assumed this was the case for other engineers in our field as well.
However, I have worked for startups that like to move really fast, and hired talented developers who passed our technical screenings (read: "had the fundamentals down") under a "framework agnostic" hiring policy ... only to see them display stunning degrees of incompetence trying to learn our tooling.
The problems that compound this are:
- When you enter a new company with a large codebase that you have to ramp up on, you're not only required to learn the language or 3rd party frameworks and libraries that they use ... you need to ramp up on THEIR "framework." Depending on the complexity of the system, there is a lot of domain specific knowledge and custom supporting code that will have been written. Try to learn the ins and outs of Angular change detection, for example, while also ramping up on a massive codebase that does things in weird ways for legacy and historic reasons.
- Every business, but some more so than others, has time pressure. You need to be able to write functional, easy to maintain code but also get it shipped yesterday. If you come into a company unfamiliar with the languages and tools that they use, you are essentially coming in handicapped. Expectations that you can deliver are very high, despite the time that you need to ramp up. Maybe you're one of those 10x'ers who can learn all the ins and outs of a new tool in a week or two before starting your position and then apply that knowledge at the level of someone whose been working with the tool for years and has learned all of the hidden footguns ... but if so, you are a rare specimen indeed. The industry can save itself a ton of inefficiency if it takes a "better not take a chance" attitude.
- All problems are people problems. It's not that the company needs people who know how to code in the language or tool ... they need someone who has worked on enough different projects with that tool that they can navigate the completely fucked up ways that THIS company uses it. Because THIS company will for sure have years of active development behind it by developers of all sorts of different experience levels ... and some of those developers did it the right way while others found creative solutions and did things weird. The company doesn't need someone who can write the Hello World tutorial in the language or framework, they need someone who can evaluate the good decisions vs the bad ones in an existing codebase.
renewiltord
Yeah that’s obvious and probably good. You’re trying to make a machine that reliably adds employees to your company in a way that minimizes nepotism or corruption.
Faced with the immutable fact that the chief executive cannot watch everything, that there will be pockets within the organization where people will sell access to a $300k job, and where others will hire from their family, their tribe, or so on: you make a system that is meant to prove some minimum standard while constraining your interviewers.
One thing that is not immediately obvious is that the Big Tech hiring process is to constrain your hiring team in who they bring on.
Startup executives are close to the road so they can tell if the rubber’s good much more easily.
The hiring process is designed around the constraint of executive attention. As are most things in firms.
zeroq
From YT comment section:
>> @TimMattison >> If this guy goes for a big tech interview they're still going to ask him how to invert a binary tree
> @MichiganTypeScript > So actually in the "why" video, you're going to hear about exactly that! I was looking for a job during working on this and absolutely got some disappointing rejections, and one was because of my lack of skillset on things like this in a big tech company's interview. I literally failed the technical screening. Oh well.
kibwen
He's also one of the principal organizers of SquiggleConf, a conference focused on devtools that takes place in Boston: https://2024.squiggleconf.com/about
What I'm saying is, if he still happens to be looking for a job, any employer reading this should be falling over themselves to recruit this man.
acemarke
I got to watch Dimitri posting internal updates about his progress on this, and it has been utterly mindblowing. This is genuinely one of the most amazing things I've ever seen done with code. Absolutely legendary feat! (And also an incredible amount of persistence.)
pcthrowaway
Where can we see these updates?
sys13
Michigan Typescript has an active discord: https://discord.com/invite/DHtwNDTwrR
dimitropoulos
the #doom channel is where Mark is referring to. it's all there!
joshuakgoldberg
Nothing will ever top this for typescript types. This is the pinnacle. An entire virtual machine and system memory with garbage collector in types.
Turing Completeness is one level, but being able to run Doom is the real test of whether a programming environment is complete and robust. Absolutely stunning to see TypeScript's type system get there.
pcthrowaway
Well we haven't implemented a web browser capable of running javascript in the typescript type system yet.
Quick, someone tell this author it's not possible.
orangecat
Doom is Turing complete (https://calabi-yau.space/blog/doom.html), so it's just a matter of building the appropriate map.
dimitropoulos
(author here) _yes I realize how ridiculous what I'm about to say is considering the project I just shared_ but I actually strongly disagree, haahah. there's this thing I learned of called "the turing tarpit". my position is that just because something could theoretically be done with infinite time and infinite resources, doesn't mean you can even approach the throne of doing it for real in a human lifetime.
And if I'm just totally wrong on this, then you have your answer on why I never gave up on this project. I never once, ever, at any point, lost hope that it wouldn't work (HOW COULD IT?!).... right up until the very instant when I couldn't deny it anymore and it was on the screen in front of me.
pcthrowaway
That's not really relevant. Turing complete languages are used to build Doom and Pong, but one is more impressive than the other.
sangeeth96
Blew my mind! Dimitri talks about it in the video but I love the mention of how this project came to be[0]:
> This engine was built to service a project that aimed to demonstrate why Doom can't run in TypeScript types. Well. The funny thing is.. It can.
[0]: https://github.com/MichiganTypeScript/typescript-types-only-...
g4zj
Can someone help direct me toward an understanding of what it means for something to be "run in/by TypeScript types"?
A short explanation or link to a resource would really be helpful. :)
aylmao
At this point the easiest way to know if a system is Turing complete is to check if someone has ported DOOM to it haha
Very impressive!
cobbal
Only if the church-turing-carmack thesis holds, which I personally doubt
ccvannorman
Alternatively if The Romero Hypothesis is proven to map the distribution of Mancubus numbers ... >_<
FergusArgyll
HN Pedantism never fails to elicit a chuckle from me
vardump
Doom compiled to just 177 TB (terabytes) of TypeScript types. Amazing on many levels.
luckystarr
This must be the quintessential example of a Turing tarpit.
In TypeScript types, everything is possible, but nothing of interest is easy.
ajkjk
I wonder if there are any small changes/improvements to TS that would make this orders-of-magnitude more efficient to run? It would be fun to go implement some random TS feature with the secret sneaky goal of making it run Wasm better.
rvnx
Arithmetics were apparently integrated into TypeScript types for that exact reason:
Rzor
If there's one top story HN deserves today, it has to be this. Absolutely insane and incredibly inspirational.
karmakaze
My literal LOL of the month. Love the types scale graphics/animation. :mind-blown:
dfabulich
A WASM runtime in TypeScript types is impressive in its own right, but I think I can dimly see how it could work with a lot of effort. https://github.com/MichiganTypeScript/typescript-types-only-...
What I don't understand is how this thing does keyboard input.
At 3:42, the video simply says, "And, yes, there's a way to do keyboard input," without elaborating on how. What sorcery is that? There must be something outside the type system translating keyboard input into TypeScript types…??
dimitropoulos
(author here) pause on that screen and look at the code displayed on the right (as well as the note at the bottom!) the way to do keyboard inputs is basically exactly what people do for tool assisted speedrunners. Some people at this point in the message just went "oh cool!" and others went "you liar! that's not the same thing!". There was SO MUCH to say in 7 minutes in a short video like that, but rest assured, I'll go into depth on that in the next videos. The pong stuff that's shown is real (only the animating part was the creative liberty) and it's in the open source codebase.
darcien
I haven't checked the DOOM one, but for the Pong example, the keyboard input is prerecorded. As in the sequence of the keyboard key press are sequenced in a TS array[0].
[0]: https://github.com/MichiganTypeScript/typescript-types-only-...
dimitropoulos
yep! exactly this! like how a tool assisted speedrunner works
pcthrowaway
If I had to guess, it's a file with an array of keys pressed (or unpressed) at some time interval (say 0.1 seconds). Then a VS code extension can append to the array every 0.1 second along with any key-press states at that time. The compiler updates the game state whenever this array gets updated.
However, I'm guessing this is why we see a demo of pong and not doom. Doom probably just can't keep up with this.
No idea if I'm remotely on the right track here though.
bilekas
This shouldn’t be possible.. Typescript devs have lost their collective minds and I’m totally here for it.
Edit : TS not front end
One of the top comments in the video:
> If this guy goes for a big tech interview they're still going to ask him how to invert a binary tree
The industry's hiring process is so messed up that this is completely believable.
"We've decided to prioritize other candidates, as you are strong in the fundamentals but lack the kind of experience in Vue that we're looking for."