Static Type Checking is Life, Static Type Checking is Love
It’s fast, runs everywhere and offers many wonderful frameworks such as Angular and React.
However, its lack of static typing can be a real pain for developers, bugs only appear at runtime, are hard to find and code refactoring is a real challenge.
This is where static type checkers such as TypeScript and Flow come into play with their main features being:
Helping to catch errors early, close to the root cause and at buildtime
Improving code readability and maintainability
When Should You Use a Type Checker?
For long and complex projects
If there is a chance you will have to refactor it at some point
If team members change regularly
If you are sick and tired of random errors induced by typing errors, you should definitely join the static type checking club!
What Does Flow Bring to the Game?
What Flow Is
The project is active – more than 30 commits are merged in average every week with bug fixing and new features.
It was introduced by Facebook in 2014 with two main features:
Finding type errors in your code
Offering a static typing syntax
How does it work?
Flow is a checker while TypeScript is a compiler.
Flow works in two different ways:
You specify to the tool the types you expect, and it checks your code based on this as shown below