Skip to content

Instantly share code, notes, and snippets.

@jeffmo
Last active October 3, 2016 16:38
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffmo/ef9214ca3acfe76c54a237b5710d37be to your computer and use it in GitHub Desktop.
Save jeffmo/ef9214ca3acfe76c54a237b5710d37be to your computer and use it in GitHub Desktop.

A few reasons why we decided to build Flow

tldr: Flow is built to find a lot more kinds of bugs than what TypeScript is built for.

Flow avoids as much gratuitous unsoundness as possible in order to find more bugs: It never infers any, it models variance for objects/functions/type parameters soundly (this is critical), it minimizes type precision loss, it has sound support for various dynamic features with inference (Function.prototype.bind()/Function.prototype.call()/Object.assign()/etc), etc.

Flow infers and understands more kinds of types with fewer annotations. Extensive inference was important to us for easing the process of converting untyped code without missing errors as much as possible. It also helps reduce boilerplate when writing new, typed code. You get to decide if and when you want to express types in your code (with type annotations), but Flow will pick things up from there without much worry of losing type info.

Flow is built on top of a more general level of code understanding that will enable it to do much more than just typecheck in the future (see ReactEU talk about the Flow graph).

Flow also runs extremely efficiently (highly parallelized). For example, it already has to scale up to millions of lines of code at Facebook.

@iansinnott
Copy link

Love the direction of Flow. It's been great to see the rapid pace of development. Talks like the recent on you gave and explanations such as this gist are a great source of insight for users like myself. Thanks for taking the time to elaborate on the "why" of Flow. 👍

@ozguruksal
Copy link

ozguruksal commented Aug 10, 2016

@jeffmo, can you share any code samples to prove what you claim because saying is easy when "Flow is built to find a lot more kinds of bugs than what TypeScript is built for"?
By the way, I believe flow is a dead end and a waste project unless someone shows code but not just say things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment