TypeScript
vs
Flow

Flow 

static type checker for your JavaScript code

How Flow Works

// @flow
function square(n: number): number {
  return n * n;
}

square("2"); // Error!
  • Combine with Babel can compile to old function allow using in old browser

TypeScript

  • typed superset of JavaScript 

module myModule {
  function objectRange(obj: Object, times: number): Object[] {
    ...
  }
  ...
}
  • new language, transpiled to JS

  • classes, interfaces, modules, generics
    - inherited from Java/.Net

TypeScript

  • runtime & compile-time

  • maintained by Microsoft & Google

How to use

  • awesome-typescript-loader

  • wepack setting

Demo
Using TypeScript in React

deck

By Stanney Yen

deck

  • 253