Hacker News new | ask | show | jobs
by lewisl9029 3148 days ago
The point of having type annotations in the spec is so that library and tooling authors can focus on providing and refining a single set of type annotations that any tool (Flow, TypeScript, anything else that comes up) can check for correctness and perform static analysis (for things like autocomplete, find references, go-to definition, etc) against. Over time, this would vastly improve the quantity and quality of available type definitions compared to what's available for either the Flow or TypeScript camp alone.

And once type annotations are part of the language proper, the possibility opens up for browsers to use type annotations to provide runtime safeguards, optimizations, and reflections, all of which would be invaluable since static checking alone is often not enough to provide correctness guarantees in all cases in JavaScript. When all is said and done, JavaScript is a dynamic language, and the ability to reuse the same type annotations for both static and dynamic checks is the piece that I'm sorely missing from both the Flow and TypeScript ecosystems so far.