Dec 14, 2020
ELI5: Flow - Static Type Checker for JavaScript
By Dmitry Vinnik and Joe Previte
Originally posted here.
In this post, we explain Flow, a static type checker for JavaScript, in a way that is super simple to understand (or as it's commonly known online, ELI5). If you're interested in learning by watching or listening, check out a video about this open source project on our Facebook Open Source YouTube channel.
Why Flow?
When writing code for a program, you want to ensure that you catch errors before your users do. Unfortunately, JavaScript by itself won't protect you from making and releasing those errors. JavaScript was built to help developers write code quickly, with type safety left to be managed manually.
At Facebook, we wanted to help our developers stay productive and enable them to ship high-quality code quickly. So we built Flow, a static type checker for JavaScript. Through intelligent program analysis, Flow checks your program in the background while you concentrate on writing quality code and reports errors back to you. It extracts information from your program to figure out precisely what you're doing. If it doesn't understand, it tells you. You then annotate your code to clarify to both other developers and Flow what your intentions are.
Flow provides real-time feedback right in your editor and lets you write JavaScript your way. It seamlessly integrates with many tools, which makes it easy to add to your existing workflow. As a result, you ship fewer bugs to production and work more productively and efficiently as a developer.
Where is it used?
Flow was open sourced in November 2014. Currently, it is used at Facebook throughout our codebase wherever we write JavaScript.
Where can I learn more?
To learn more about Flow, visit the website. It has excellent documentation for developers who are just starting, and developers want to use more advanced features. If you would like to see Flow in action, you can try it online using the Flow playground. If you have any questions, you can go to the Flow's Discord, Twitter or StackOverflow.
If you want to see more content about Flow, let us know on our YouTube channel, or by tweeting at us.
About the ELI5 series
In a series of short videos (~1 min in length), one of our Developer Advocates on the Facebook Open Source team explains a Facebook open source project in a way that is easy to understand and use.
We will write an accompanying blog post (like the one you're reading right now) for each of these videos, which you can find on our YouTube channel.
To learn more about Facebook Open Source, visit our open source site, subscribe to our YouTube channel, or follow us on Twitter and Facebook.
Interested in working with open source at Facebook? Check out our open source-related job postings on our career page by taking this quick survey.