DEV Community

Discussion on: A Type System

Collapse
 
mindplay profile image
Rasmus Schultz

Also check out Hegel - a static type-checker for JS that attempts to achieve soundness, which also enables far more powerful inference.

Obviously, this project is new, and has to basically "start over" on many of the things that TS added over the years. To avoid that, they do try to leverage existing .d.ts files, but this only seems to work for the most basic type-definitions right now, and man do they have their work cut out for them.

Still, this is definitely worth a look - I would strongly encourage anyone to at least spend 20 minutes poking around in the online playground to see what this is about. If you don't already know something like Elm or ReScript, you will be surprised by the safety you get from sound type-checking, and with a much smaller amount of manually type-hinting compared with TS.

This project is so overlooked, and really deserves a lot more attention than it gets. I think maybe some people are already fatigued by the constant growing complexity of TS, and my own early reaction was something like "ugh, another type-checker?" - but this really is a whole different ball game. Don't skip this one! 🙂

Collapse
 
peerreynders profile image
peerreynders

Given

Hegel is only JavaScript with types

and

an advanced static type checker

(i.e. Hegel is a tool rather than a language) it seems that comment syntax should be a "rather sooner than later" feature

  • to mitigate the risk of adoption
  • to make potentially lengthy type checking passes optional for regular red-green-refactor cycles. While this may sound weird from the static typing perspective this is what seems to be driving JSDoc TS adoption (TypeScript as a tool rather than a language or compiler).