DEV Community

Discussion on: Tossing TypeScript

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited
  • Type safety is opinionated, and TypeScript team choose not to emit runtime type checks.
    • I think Hegel is a tried alternative. I don't know how well it works, though.
  • You should always consider safety beyond types. Validating users' (or even devs') inputs are way beyond that (e.g. empty string "", and empty arrays [], are possible even in dev environment).
Collapse
 
somedood profile image
Basti Ortiz

Wow. Hegel looks very promising, but I'd imagine the build times to exponentially soar. I'd say this is an option worth considering particularly for the front-end (i.e. clients and front-facing APIs).

Thread Thread
 
patarapolw profile image
Pacharapol Withayasakpunt

You know that even tsc (or ts-node / ts-node-dev) can be slow to compile, right? Not as bad as Gradle, though.

Thread Thread
 
somedood profile image
Basti Ortiz • Edited

Yup, I believe I am too familiar with that reality. 😂

I just figured that the additional runtime checks make compilation more computationally expensive, hence the longer build times than "just" TypeScript.

Collapse
 
bytebodger profile image
Adam Nathaniel Davis

Oh... that's cool. I hadn't even heard of Hegel before. I'm definitely going to look into that one.