Slide 1

Slide 1 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 1/10 Peter Lazar @peterlazar1993 TYPECHECKING IN JAVASCRIPT

Slide 2

Slide 2 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 2/10 Pop Quiz c o n s t a d d = f u n c t i o n ( o p e r a n d 1 , o p e r a n d 2 ) { r e t u r n o p e r a n d 1 + o p e r a n d 2 } a d d ( { } , { } ) a d d ( { } , [ ] ) a d d ( " " , { } ) a d d ( " " , [ ] ) a d d ( 1 + " " ) a d d ( 1 + [ ] ) a d d ( 1 + { } ) a d d ( 1 , 1 )

Slide 3

Slide 3 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 3/10 TYPES STRONG/WEAK TYPING STATIC/DYNAMIC TYPING A type is a classi cation identifying one of various types of data, such as real, integer or boolean, that determines the possible values for that type, the operations that can be done on values of that type, the meaning of the data, and the way values of that type can be stored.

Slide 4

Slide 4 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 4/10 Code

Slide 5

Slide 5 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 5/10 JavaScript's type system makes it extremely exible and extremely easy to screw up. - Peter

Slide 6

Slide 6 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 6/10 TYPESCRIPT FLOW LET'S PUT TYPES IN JAVASCRIPT

Slide 7

Slide 7 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 7/10 FLOW Static Type Checker Type Inference Type Annotations Opt-in Realtime Feedback

Slide 8

Slide 8 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 8/10 Code

Slide 9

Slide 9 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 9/10 Questions? @peterlazar1993

Slide 10

Slide 10 text

9/25/2016 Typechecking in Javascript http://localhost:3000/#/?export&_k=dacai8 10/10 PS: You should check out elm PPS: These slides were made using Spectacle, React based presentation library