This parser is not written in TS types, and this kind of pedantry (especially when claiming "no js here!") is important. In fact, the parser includes many uses of both the ternary operator as well as the rest operator, both of which are absolutely not part of the type system and are most certainly part of JS.
While this tries to reach the levels of "TypeScript is Turing complete[1]" (which happens to be super cool), it is, in my humble opinion, not even remotely as interesting.
Sometimes at work I can't figure out some TS type and start thinking it's impossible. Then I remember that repos like this exist, and if some guy really managed to parse Typescript types in Typescript, that my problem is peanuts compared to that.
That usually motivates me to solve my problem.
Etheryte · 35m ago
On the flip side, if you can't find a close enough type definition with reasonable effort, it's often a sign that you're about to enter gibberish type territory and it might be time to reconsider. Even if a type does exist in the end, it might be unparseable to every human on your team, future you included.
bapak · 1h ago
Some things are still impossible. I lost count of the bugs I reported to TS only to be told that "works as intended" or that it's a "design limitation."
While this tries to reach the levels of "TypeScript is Turing complete[1]" (which happens to be super cool), it is, in my humble opinion, not even remotely as interesting.
[1] https://github.com/Microsoft/TypeScript/issues/14833
That usually motivates me to solve my problem.
https://github.com/sinclairzx81/typebox#syntax