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.
(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.
Of course you're right, and I should have put quotes around "just". It would be amusing to calculate how long it would take to render the Google home page via Doom via TypeScript; I'd guess much longer than the age of the universe.
Off topic, but as an obsessive debugger and experimenter with ADHD and someone who hates telling people lies about what can and can't be done your motivation speaks to my soul. But my usual rabbit holes last just few hours up to few days. And even those that go far (that avoided all obstacles) end up right before implementing the last step, when it becomes obvious to me that this thing can be done. Congrats on the sheer stamina.
I might use lesson you provided in my future to actually achieve something. I just need to doubt the feasibility of even the last step.
> 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.
Has this experience changed your way of thinking at all? It sounds like the thing people thought was possible actually was possible, and that Turing completeness really did mean what people thought it did.
I hope this doesn't come off wrong like but honestly - but the outcome on this project doesn't change my view one bit. it didn't make me dig in my heels either, but I strongly doubt it's possible in a human lifetime to do this with at least some of the other languages that have type systems that are considered Turing complete.
It looks like they built a WASM runtime in the TS type system. Implement some more OS calls and you should be able to get a browser running. And then WASM on WASM on TS types. Lol
Or more specifically, everything that is Turing complete can run DOOM, but most languages are only Turing complete under certain assumptions which are not met in practice
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.)
Brilliant. The TS type system is a true marvel of modern software engineering. Its a shame that it hasn't just been developed into a proper fully fledged runtime at this point. Something like Deno is the closest we'll get it seems.
hi! author here! selfishly, it'd be really useful to me if you could take a moment to elaborate on your thinking here. it's not an altogether-too-too-uncommon viewpoint and I'd like to understand it if you have a chance.
I didn't ask them outright, but I sorta think the TypeScript team might agree with you on this point! haha. At least we can all agree it's not an intended use-case, to play Doom.
(author here) that was one of the 1st-week "ok, but THAT'S surely a good reason this can't work..." until I dug in and (to my great surprise) found a way.
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…??
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].
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.
If I heard him correctly he stated that it takes A LOT to just render a single frame. It's not playable. It can run DOOM, but you can't actually play it.
(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.
Not only is Dimitri an amazing engineer - he's also great at building community and event/video production. Michigan Typescript meetups and videos have a level of polish that goes over and above
In the YouTube comments he stated nonetheless that he still bombed big tech interviews, specifically the technical portion, probably because of some ridiculous LeetCode problem he did not memorize beforehand. It just goes to show how these procedures do not effectively determine who is actually a good engineer or programmer. If this guy can't land a job while achieving this, then something is not quite right with the interview process.
hi! yep! this definitely happened. I do mention it in the next "why" video, but it's good feedback to know this is interesting to people because I could say a bit more about what those rejections were like - specifically the one where I failed the technical screening.
I'm actually really excited to share that part of the story because I hope it can be a small thing in the back of people's mind to help them if it happens to them. It can happen to anyone. Interviews are SUCH a lossy process and most engineers I know don't have any training on how to do interviews at all - yet we just assume they know how to evaluate people's skillsets.
I was crushed and embarrassed. Yep. Not even gonna lie.
I used to work on Insomnia at Kong, which is literally a frontend for cURL. But some of the questions I couldn't answer were like "how do you get headers with cURL". I DON'T FRIGGIN KNOW. THAT'S WHY I WORKED ON A GUI FOR CURL. I CAN'T STAND USING THE CLI. lol. But to them, it was a question they were supposed to ask, and I got it wrong. Same story for questions about the git CLI DX (I'm a GitKraken fanatic lol), and more like that.
I would rate my confidence overall as being quite low. Well. I donno how to explain what I'm trying to say. It's not that it's low or high, it's that I don't factor it in a lot in what I decide to do. Where I've noticed some people dip their toe in, I find it easy to just cannon-ball into the frozen lake without needing a lot of justification. That's what I meant in the video about "close-enough-manship". I'm a sort of personality that spends a lot of time just failing miserably over and over again in the least efficient way possible until I get what I'm looking for - and I usually quickly move on before I learn what I could have done better, lol. I've been told that my comfort in the face of non-stop-failures is what confidence is, but I donno if that sounds right.
Getting a job these days is really tough on the psyche.
You have coding skills. Some marketing and video production skills. Self discipline and persistence. The time to spend 18hr days on a project. Why look for employment? Start your own business.
are you some kind of fortune teller!? haha. so that's so funny you say that because that, too, is a big part of the story. actually I was gearing up to do exactly that - but everything blew up in my face and this Doom project was, in many ways, my way of picking up the pieces from the rubble.
there's another reason, which is that I really get a lot of energy from working with other people. it makes me really happy. and right now especially I really love the people I work with. I learned this lesson the hard way in my stint contracting - because the inter-personal relationships are very different when you're there one day and gone the next (as a contractor).
Those interviews select for the type of person that believe it is worthwhile to dump tons of time into studying minutia to succeed at those types of interviews.
The purpose of a system is what it does, after all.
You're making an excellent case for using AI during the interview. If you can actually code and do the work, you're hurting no one by using tools to get past these arbitrary barriers during the live interview. The system is clearly flawed when someone demonstrably skilled gets rejected over trivia.
I actually created a tool to help myself get through the live interviews, specifically by listening to the questions and giving me real time answers to things I couldn't recall under that kind of pressure. It's not about not knowing the material, it's about the ridiculous expectation to perform perfectly on demand.
imagine how amazing it would be if every major browser tomorrow suddenly dropped support for JS entirely and said that they only run typescript now. It will be a hard but absolutely mind blowing transition
What would be the point? Why waste time parsing and ignoring types? Types are for static analysis during comp time, they have nothing to do with the runtime and they don't provide "type hints" to the runtime about types, and code isn't optimized based on static typing analysis. Or should the browser do that? In that case which version of TypeScript? And by version I actually mean which tsconfig? Sorry for being picky but can't image why we would want something like that. If all we wanted was a compiled runtime like flash/actionscript was then I wonder why we killed flash
it would get rid of babel immediately and the billions of hours of transpile time spent across the planet by people converting ts into js. You ll be able to run ts natively without transpilation across every major browser
Most people would agree that Mengelberg‘s 1984 paper clearly answers that question … of course, we all know that his language is famously hard to parse!
both this and parent comment are right! once you have the first frame, it's probably just a few hundred more megabytes to get the second one - although I won't be the one to find out! 1 is enough for for me!
I hope he learned something useful while doing it and it seems like he did, because, although regarding all the comments here I'll likely be alone in my assessment, I just see a massive waste of time & effort? He described it as "a brutal year-long journey of 18 hour days" and he didn't bootstrap a company, he wrote Doom in Typescript types...?! The "epic" doom music underlying his story just makes it seem even more comical to me.
Maybe it's just me, don't want to crash the party. Carry on
I guess you have to ask yourself, what truely gives value in life? The answer is that value is subjective, and this person is wasting his time no less or more than you or I.
Kinda seems like you do wanna "crash the party". I disagree that this is a "waste of time" of course, the value I see here is manyfold:
1. Learning how to do self-directed learning, managing time, etc
2. Learning, at an expert level, about dozens of complicated (not to mention in-demand) CS subdomains
3. Doing something that nobody has attempted, and few people could realistically accomplish
4. Having fun on the journey of taking a ridiculous idea from conception through to a truly functional implementation
5. Sharing something you've built with the world
It is, of course, not everyone's cup of tea, but if someone wants to spend a not insignificant fraction of their life building something unique (and beautiful, in its own way) and sharing it with the world, to the detriment of quite literally nobody else, I support them in their adventure.
Recreating the WASM runtime makes you learn a crap ton of useful stuff no matter what you use as your host compiler. In this case, the host being the typescript compiler happens to also add a wow-factor.
It's just you. It's extremely impressive. He likely set himself up for life with this + learned an unbelievable amount. And this is, in and of itself, a business. He has merch, a conference, a social media presence, etc.
390 comments
[ 3.1 ms ] story [ 133 ms ] threadTuring 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.
Quick, someone tell this author it's not possible.
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.
I might use lesson you provided in my future to actually achieve something. I just need to doubt the feasibility of even the last step.
Has this experience changed your way of thinking at all? It sounds like the thing people thought was possible actually was possible, and that Turing completeness really did mean what people thought it did.
> 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-...
Beware with such blanket statements, you might inspire someone to do 18-hour days for a year to prove you wrong.
(via https://news.ycombinator.com/item?id=43185174, but we merged that thread hither)
Edit : TS not front end
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…??
[0]: https://github.com/MichiganTypeScript/typescript-types-only-...
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.
I'm actually really excited to share that part of the story because I hope it can be a small thing in the back of people's mind to help them if it happens to them. It can happen to anyone. Interviews are SUCH a lossy process and most engineers I know don't have any training on how to do interviews at all - yet we just assume they know how to evaluate people's skillsets.
About those rejections, did they effect your confidence in yourself and your skills? How did they make you feel?
I used to work on Insomnia at Kong, which is literally a frontend for cURL. But some of the questions I couldn't answer were like "how do you get headers with cURL". I DON'T FRIGGIN KNOW. THAT'S WHY I WORKED ON A GUI FOR CURL. I CAN'T STAND USING THE CLI. lol. But to them, it was a question they were supposed to ask, and I got it wrong. Same story for questions about the git CLI DX (I'm a GitKraken fanatic lol), and more like that.
I would rate my confidence overall as being quite low. Well. I donno how to explain what I'm trying to say. It's not that it's low or high, it's that I don't factor it in a lot in what I decide to do. Where I've noticed some people dip their toe in, I find it easy to just cannon-ball into the frozen lake without needing a lot of justification. That's what I meant in the video about "close-enough-manship". I'm a sort of personality that spends a lot of time just failing miserably over and over again in the least efficient way possible until I get what I'm looking for - and I usually quickly move on before I learn what I could have done better, lol. I've been told that my comfort in the face of non-stop-failures is what confidence is, but I donno if that sounds right.
Getting a job these days is really tough on the psyche.
there's another reason, which is that I really get a lot of energy from working with other people. it makes me really happy. and right now especially I really love the people I work with. I learned this lesson the hard way in my stint contracting - because the inter-personal relationships are very different when you're there one day and gone the next (as a contractor).
The purpose of a system is what it does, after all.
I actually created a tool to help myself get through the live interviews, specifically by listening to the questions and giving me real time answers to things I couldn't recall under that kind of pressure. It's not about not knowing the material, it's about the ridiculous expectation to perform perfectly on demand.
Very impressive!
In TypeScript types, everything is possible, but nothing of interest is easy.
Yoooo WTAF
Maybe it's just me, don't want to crash the party. Carry on
> I just see a massive waste of time & effort
Kinda seems like you do wanna "crash the party". I disagree that this is a "waste of time" of course, the value I see here is manyfold:
1. Learning how to do self-directed learning, managing time, etc
2. Learning, at an expert level, about dozens of complicated (not to mention in-demand) CS subdomains
3. Doing something that nobody has attempted, and few people could realistically accomplish
4. Having fun on the journey of taking a ridiculous idea from conception through to a truly functional implementation
5. Sharing something you've built with the world
It is, of course, not everyone's cup of tea, but if someone wants to spend a not insignificant fraction of their life building something unique (and beautiful, in its own way) and sharing it with the world, to the detriment of quite literally nobody else, I support them in their adventure.
Recreating the WASM runtime makes you learn a crap ton of useful stuff no matter what you use as your host compiler. In this case, the host being the typescript compiler happens to also add a wow-factor.