title: React - using TypeScript vs Flow vs?
body: <p>I'm currently learning React and I think I understand it pretty well. However, there's one thing that's been bothering me regarding development of robust React applications - what tools do developers use for static type checking?</p>
  
  <p>I really like TypeScript. I think it reduces the pain of developing JavaScript applications quite a lot, thanks to type checking and other neat features. Visual Studio Code also offers a really nice code completion. And I know that I can make it work with React by using <a href="https://github.com/typings/typings" rel="noreferrer">typings</a> + <a href="https://github.com/DefinitelyTyped/DefinitelyTyped" rel="noreferrer">DenifitelyTyped</a>.</p>
  
  <p>The thing is, there aren't many tutorials about using React + TypeScript. There also doesn't seem to be many articles about developing using this combo. On the other hand, many people seem to be using <a href="http://flowtype.org/" rel="noreferrer">Flow</a>, which is a project backed by Facebook (and I guess they also use it).</p>
  
  <p>I've managed to find a <a href="https://www.reddit.com/r/javascript/comments/39cere/typescript_vs_flow_results_from_our_investigation/" rel="noreferrer">discussion on Reddit</a> with pros and cons about going the React + TypeScript / React + Flow way. However, to me, it appears to be quite outdated as it is about 10 months old now. I think a lot has changed since then.</p>
  
  <p>I've also found two articles about using <a href="https://blog.wearewizards.io/flow-and-typescript-part-1-flow" rel="noreferrer">React + Flow</a> and <a href="https://blog.wearewizards.io/flow-and-typescript-part-2-typescript" rel="noreferrer">React + TypeScript</a>. The author states some issues he's run into when using both of the options and concludes that TypeScript is "the best bet right now" (November 2015), especially because the Flow project has many issues and receives low developer activity from Facebook. He also mentions it doesn't play well with Babel?</p>
  
  <p>So, I guess the question would be: Is it safe to use the React + TypeScript combo, or will I run into some difficulties? What about Flow? Are there some other similar tools I should check out? Which approach would you recommend?</p>
  
  <p><strong>Update September 2017:</strong></p>
  
  <p>Having more than a year of experience with daily use of TypeScript, and playing with Flow for a while, I've came to the following conclusions:</p>
  
  <ul>
  <li>TypeScript is still painful to use to this very day. The problem is that the JavaScript world just moves so fast that TypeScript keeps lagging behind. Thinking about using that fancy new ES7 stage 3 feature? Nope, you can't. Wishing to get type hints for the latest version of some library? Wait a month, or two, maybe more...</li>
  <li>Flow has come a long way, it has been improved a lot, it can catch some things that TS can't. Best of all, it finally works on Windows. Also, there's great plugin for VS Code (no idea why it has only 3/5 rating). And it works 100 % with React Native, TypeScript is not even 50 % there yet.</li>
  <li>Most of the time, you don't need types at all. All the additional typing is rarely worth it. JS is a dynamically typed language, get over it :)</li>
  </ul>
  
  <p>TL;DR: If you plan to use any type checker, I recommend using Flow.</p>
  
  <p><strong>Update February 2019:</strong></p>
  
  <p>I believe the recommendation above got out of date and is no longer relevant. Three reasons:</p>
  
  <ul>
  <li><a href="https://reactjs.org/docs/hooks-intro.html" rel="noreferrer">React Hooks</a> are here. They make type-checking your code much easier. <a href="https://fettblog.eu/typescript-react/hooks/" rel="noreferrer">In most situations, no additional code is needed.</a></li>
  <li>TypeScript's type inference has improved.</li>
  <li>TypeScript has much bigger community than Flow. Even yarn, Facebook's package manager, <a href="https://github.com/yarnpkg/yarn/issues/6953" rel="noreferrer">is moving away from Flow, to TypeScript</a>.</li>
  </ul>
  
  <p>So, I think TypeScript is a much more pragmatic choice than Flow in 2019.</p>
  
  <p>As to whether it's even worth using any type checker at all, I'd say it depends on the project size. Small projects probably don't need it.</p>