4 ms·
Huh? The whole point of static typing, in any language, is basically: - Catch more errors at compile time - Better tooling (better intellisense, “go to defini
by yashap 6y ago
Huh? The whole point of static typing, in any language, is basically:
- Catch more errors at compile time
- Better tooling (better intellisense, “go to definition”, “find implementations”, etc.)
TypeScript provides both of these benefits just fine. Runtime types give you better runtime errors, and less undefined behaviour, but plain JS (or TS compiled to JS) does that bit just fine. TS types persisting at runtime could maybe be nice for certain use cases, like more powerful reflection, but that’s not type safety.
What’s a concrete example where your program would be more safe if TypeScript types were represented at runtime?