Model
Promise immutability
[flow] property `username` (user.js:20:7)
Covariant property `username` incompatible with
contravariant use in assignment of property
`username`
Slide 22
Slide 22 text
Model
Promise immutability
Slide 23
Slide 23 text
Actions as
Immutable
Slide 24
Slide 24 text
Flow Type for
React
Component
Slide 25
Slide 25 text
React PropTypes
or
Flow?
Slide 26
Slide 26 text
Components
Prefer using
Generic Style
Slide 27
Slide 27 text
Components
Prefer using
Generic Style
Slide 28
Slide 28 text
Components
Prefer using
Generic Style
Slide 29
Slide 29 text
React
Component
with
$PropertyTypes
Slide 30
Slide 30 text
Adding
Props
With
HOC
Slide 31
Slide 31 text
Adding
Props
With
HOC
Slide 32
Slide 32 text
Adding
Props
With
HOC
Slide 33
Slide 33 text
Error Case
Adding
Props
With
HOC
Slide 34
Slide 34 text
Other tips
Slide 35
Slide 35 text
https://github.com/flowtype/flow-typed
flow-typed install
Third Party
https://github.com/facebook/immutable-js/blob/master/type
-definitions/immutable.js.flow
Finally, Immutable.js supports Flow type in v4.0.0-rc1
Compare
Typescript
if you use Flow, you'll have much higher
type coverage much faster and you'll be
able to sleep soundly.
http://thejameskyle.com/adopting-flow-and-typescript.html
Slide 38
Slide 38 text
Swagger
Flow Type
A Swagger file has
more than 8000 lines
Writing Type Definitions manually is HARD
Conclusion
⊙ Utility types are useful
○ $Exact
○ $PropertyType
○ Class
○ Immutability
⊙ Prefer Flow than Proptypes
⊙ Prefer Generic Component
⊙ swagger-to-flowtype is useful
Slide 44
Slide 44 text
型安全 is Rock
Slide 45
Slide 45 text
We are hiring!!!
Slide 46
Slide 46 text
Thanks!
Any questions?
You can find me at @yayoc &
[email protected]
Slide 47
Slide 47 text
Credits Special thanks to all the people who
made and released these awesome
resources for free:
⊙ Presentation template by
SlidesCarnival
⊙ Photographs by Unsplash