2 ms·
> What everyone wants: Autogenerated type guards by class. I’m quite sure people are asking for that, but I’m quite sure they’d regret wanting it if they got i
by eyelidlessness 4y ago
> What everyone wants: Autogenerated type guards by class.
I’m quite sure people are asking for that, but I’m quite sure they’d regret wanting it if they got it. To the extent it’s desirable, it’s a thing that should be in TC39, not in TypeScript. The wailing and gnashing of teeth over when or whether or how type coercions happen is already mythical for the underlying language. Adding it to a compiler that’s increasingly not used to compile but only to type check is gonna add ten years of gripes about JS tooling nonsense to every single discussion.
They have considered this feature. Type guards are the solution and they’re a really good solution given the circumstances.