3 ms·
That's not an issue if you code properly. Most statically typed languages only have run-time type information as a sort of "ok fine if you're desperate you can
by IshKebab 5y ago
That's not an issue if you code properly. Most statically typed languages only have run-time type information as a sort of "ok fine if you're desperate you can use it, but please don't" feature.
Exceptions are a special exception in Typescript because they can come from pretty much anywhere so it can't realistically know the type at compile time.
For everything else you are probably want discrimination unions.
- yashap 5y agoYeah, for your own code it’s not really an issue, as long as you’ve got decent team-wide discipline. But when integrating with external libraries, especially JS ones with type definitions tacked on later, it can be an annoyance.