Some of the language changes when TypeScript types become real (with ahead-of-time compilation)
Oct 9, 2026 · 6:18 AM UTC
74
41
944
208,665
@bunjavascript @jarredsumner why a runtime behavior change over a compile time error when assertions can't be verified? I mean it's explicit but imo Number(raw) is more explicit and an easy change. Also what does it do to structural types?
2
0
66
4,829
@bunjavascript this feel worse than making a new language because now you need to know which runtime behavior it is. LLMs will get tripped up by this.
0
0
9
683
@bunjavascript how do you check `val as ComplextGenericTypeVar` ?
0
0
4
872
@bunjavascriptespect.
That’s all cool and really improves the logic, but then call it BunScript and use the .bs extension💁♂️
By changing how TypeScript works - almost everywhere - you are taking on a lot and only increasing development chaos.
If you want to fix the TS, go through its committee.
That’s all cool and really improves the logic, but then call it BunScript and use the .bs extension💁♂️
By changing how TypeScript works - almost everywhere - you are taking on a lot and only increasing development chaos.
If you want to fix the TS, go through its committee.
4
1
204
4,360
@bunjavascript Rename to BunScript because it isn’t isomorphic.
0
0
1
308
@bunjavascript I am all for types, but "`as` converts" is a mistake.
1
0
84
4,846
@bunjavascript as a standalone idea, this is fine, but this isn't TypeScript - you've invented a language that looks identical but works entirely differently
0
0
49
2,697
@bunjavascript This is all pretty cool, but I think using `as` for converting types is a mistake, it should just be used for type assertions, like assignments do in this implementation
0
0
16
2,455
@bunjavascript Mostly agree, but not with "as converts".
`as` should assert a value's type, not change it.
Coercing invalid values can hide bad input.
Type mismatches should throw; conversions should be explicit, e.g. `Number()`. Thoughts, @jarredsumner?
`as` should assert a value's type, not change it.
Coercing invalid values can hide bad input.
Type mismatches should throw; conversions should be explicit, e.g. `Number()`. Thoughts, @jarredsumner?
1
0
14
1,626
@bunjavascript looks pretty cool but are we still calling it TypeScript or is it BunScript now? 🤔
0
0
9
807
@bunjavascript Impressive, but at this point it's just not TypeScript anymore and this will likely cause chaos and incompatibility issues. Having the same code behave differently on the backend Vs the browser feels like a really big problem to me.
0
0
5
356
@bunjavascript Seems so obvious now, the types are already there, fuck yes they should be real.
0
0
5
1,936
@bunjavascript So, bun is turning TypeScript into a real language. What a world we live in.
0
0
3
762
@bunjavascript I don't think it's necessary to alter the TypeScript semantics.. I believe it's better to use the types to guide the AoT.
0
0
2
461
@bunjavascript all the checks are great, but as should never convert, it should check
0
0
2
454
@bunjavascript Oh come guys, this isn't that hard. You could still show the source of a function e.g.
It just blows up your binary.
It just blows up your binary.
0
0
3
469
@bunjavascript just call it BunScript with .bs instead of ts anymore
0
0
1
251
@bunjavascript Like the idea behind this in principle, but co-opting TypeScript for this feels wrong when it is entirely new behavior, and I fear it will cause confusion/fragmentation in the ecosystem. Treat it as your own, new language: BunScript, or something.
0
0
1
455
@bunjavascript This isn't TypeScript anymore, call it something else
0
0
1
404
@bunjavascript How does it work with discriminated unions, does it throw if a runtime value isn’t one of them? & does it allow branded types?
0
0
1
775
@bunjavascript @cirospaciari Awesome! Next... zod like validator built-in 😎
0
0
1
744
@bunjavascript failing ahead-of-the-time is good, but changing javascript specification is questionable
0
0
1
665
@bunjavascript The `as any` case is the migration edge: runtime checks catch bad data, but existing TS can start throwing where it used to run. Is there an opt-out?
0
0
0
4
@bunjavascript I think it'll be better to have "converts" be called "casts"? It's a more familiar term.
0
0
0
23
@bunjavascript `as` should never convert, there are existing functions to parse numbers.
Which ones are built time vs runtime errors?
TypeScript is primarily structurally typed so these nominal errors go against that.
Which ones are built time vs runtime errors?
TypeScript is primarily structurally typed so these nominal errors go against that.
0
0
0
50











































