3 ms·
> And it’s increasingly common that the code is written in TypeScript, which has tons of static analysis potential. It's probably worth noting that TypeScript'
by munificent 5y ago
> And it’s increasingly common that the code is written in TypeScript, which has tons of static analysis potential.
It's probably worth noting that TypeScript's type system is deliberately unsound in a couple of corners that make it hard for a compiler to rely on the type system for optimization purposes.
- eyelidlessness 5y agoI’m very aware of that, both from building libraries around the type system and watching the type system itself evolve over the last few years. While unsoundness is still a principle of the project, quite a lot of it has been addressed since 3.6 or so. But an optimizing AOT compiler doesn’t need TS to be sound any more than a JS JIT does. It just needs to optimize the paths it has confidence in. To the extent TS code hasn’t escaped type safety, a compiler can be aggressively strict and optimize wherever the types are unambiguous. And it can fall back to the dynamic compilation it already has otherwise.