Skip to content

Instantly share code, notes, and snippets.

@someguynamedmatt
Forked from briangonzalez/typescript-vs-flow.md
Last active November 9, 2017 19:16
Show Gist options
  • Save someguynamedmatt/7fad4626dba46f41b66fee856aaefa3c to your computer and use it in GitHub Desktop.
Save someguynamedmatt/7fad4626dba46f41b66fee856aaefa3c to your computer and use it in GitHub Desktop.
Typescript vs. Flow

Flow vs. Typescript

Flow

Built by Facebook

Stats for past month: 0 merged PRs, 30 Proposed PRs, 50 closed issues, 135 new issues, SO Questions ~0.9k

Used by: Facebook...

Created: 2014

PROS

  • πŸ‘ Built by Facebook, just like React – in practice, this doesn’t seem to provide a marked advantage for flow
  • πŸ‘ Babel integration
  • πŸ‘ No real learning curve
  • πŸ‘ Inference of types
  • πŸ‘ support for JSX

CONS

  • πŸ‘Ž No β€œout-of-the-box” integration with any editor
  • πŸ‘Ž Poor error messaging
  • πŸ‘Ž Poor tooling (Getting Flow to run is not easy)
  • πŸ‘Ž bug with JSX spread operator ( <Component {...props} /> )
  • πŸ‘Ž Does it detect unused vars? β€œNo. Use a linter.” -A Flow developer response :(
  • πŸ‘Ž non-native watch mode
  • πŸ‘Ž .js files could be flow, could be normal JS – not obvious at a glance

MEHs

  • πŸ‘ /πŸ‘Ž Flow is highly interested in creating a provably correct type system
  • πŸ‘ /πŸ‘Ž ~400 typed third-party libraries

Typescript

Built by Microsoft

Stats for past month: 215 merged PRs, 46 Proposed PRs, 440 closed issues, 215 new issues, SO Questions ~38k

Used by: Lyft, Microsoft, Google, Asana

Created: 2012

PROS

  • πŸ‘ Out-of-the-box, first class VSCode integration
  • πŸ‘ Easier to setup
  • πŸ‘ Used by default in Angular2
  • πŸ‘ Helpful error messaging
  • πŸ‘ .ts files easy to distinguish between .js files
  • πŸ‘ (as of 2.3) ability to type-check non-TS files with --checkJs
  • πŸ‘ support for JSX
  • πŸ‘ Babel integration
  • πŸ‘ Native watch-mode (file specific)
  • πŸ‘πŸ‘πŸ‘ ~3,000 third-party libraries

CONS

  • πŸ‘Ž Possible increased language complexity --> learning curve
  • πŸ‘Ž In my experience there are frequent breaking changes from version to version (not sure if this is still a problem)

MEHs

  • πŸ‘/πŸ‘Ž More frequent releases, this can introduce breaking changes
  • πŸ‘/πŸ‘Ž Typescript is not interested in creating a β€œprovably correct” type system – instead tries to strike balance between correctness and productivity

Links

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