Types on top of JavaScript.
WHAT IT IS
JavaScript with a type system, compiled to plain JavaScript.
WHAT THAT MEANS
Browsers do not run it directly. It is checked, then converted.
WHAT IT PROVIDES
Errors caught before running Documentation of what functions expect and return
Better tooling: completion, navigation, safe renaming
WHAT IT DOES NOT PROVIDE
Runtime safety.
WHY
Types are removed at compilation. Data arriving at runtime is unchecked.
WHAT THAT MEANS
External data must still be validated, regardless of its declared type.
WHAT PROBLEM IT SOLVES
Errors from values being a different shape than assumed, which is the commonest class of JavaScript bug.
WHEN IT IS WORTH ADOPTING
Projects of any size worked on by more than one person Anything maintained over time Anything where correctness matters
WHEN IT MAY NOT BE
A small script, written once.
WHAT IT COSTS
A build step, and some initial effort.
WHAT TO EXPECT
Slower writing initially, and considerably less debugging afterwards.