Static Type Checker
Static type checking is the process of checking type safety based on source code. It offers some awesome benefits like caching errors early, limiting type errors, supporting auto-completion, generating documentation, and resulting faster compilation.
A number of useful and common programming language features cannot be checked statically, such as downcasting. Thus, many languages will have both static and dynamic type checking; the static type checker verifies what it can, and dynamic checks verify the rest.
Static type checker comes with a type system and provides the backbone needed for many useful IDE features such as error highlighting, autocomplete, and automated refactoring.
Static type checker helps developer write code with fewer bugs by adding types to your code, trying to catch type errors within your code, and then remove them during compile time.
Following Flow documentation to add Flow into your project, making sure Flow syntax will be stripped from compiled code, and migrating to Flow at your own speed, manually run commands to analyse your code and generate insightful information.
Flow can automatically infer type information from existing code by using a technique they called flow analysis, and pick up any type errors by itself.
Flow is incrementally adoptable and it can be easily added and removed from our code base without breaking anything, it good in case we only want to enable type checking for only one part of our project.
Optional type system — you use type annotations at your own speed; the more you use, the more benefits you get from static type checking.
Great community support — has awesome community and tooling system backed by Microsoft.
TypeScript has great support in all major text editors and IDEs, making your life easier with code completion and type inferences.
Flow and TypeScript have their own strengths and weaknesses. TypeScript is getting more and more popular when many companies and open source projects are migrating into it.
If you’re working on a large project that’s built to last, using static type checker is almost certainly a good idea. On the other hand, if you’re just throwing together a small weekend project, it’s probably safe to skip static typing.
And finally, I think that both Flow and TypeScript have reached a stage where they are totally valuable to use. It’s a matter of preferences and what works for you might not work for me.
Originally published at https://hoangbkit.com.