Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Typechecking in Javascript using Flow

Typechecking in Javascript using Flow

- What is Typechecking
- Dynamic vs Statically Typed Languages
- Why is typechecking required in Javascript
- Flow Type annotations
- Examples with React https://github.com/tejasbubane/todo_flow

Tejas Bubane

May 17, 2017
Tweet

More Decks by Tejas Bubane

Other Decks in Programming

Transcript

  1. DYNAMICALLY TYPED ▸ No type definitions to write ▸Throws errors

    at runtime ▸ e.g. Ruby, Javascript ▸Ease of development, no restrictions ▸ Typechecking at runtime
  2. STATICALLY TYPED ▸Types defined explicitly & checked at compile time

    ▸Catch errors at compile time ▸e.g. Java, Scala, Swift, etc. ▸little overhead of writing types all the time
  3. WHY JAVASCRIPT ??? ▸ 1 == “1” => true ▸

    true == 1 => true ▸ null == undefined => true ▸ a = 1; b = “1”; a + b; => “11” ▸ this => ???? ▸ typeof NaN => ‘number’ ▸ “1” - “2” => -1 COERCION, GLOBAL VARIABLES, CHANGING SCOPES…..