Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Practical Flow Type
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
yayoc
July 14, 2017
Programming
1
790
Practical Flow Type
Slides presented at gotanda.js
Nobuhide Yayoshi
yayoc
July 14, 2017
Tweet
Share
More Decks by yayoc
See All by yayoc
optional chainingの話
yayoc
0
280
Proxy's Black Magic
yayoc
0
200
What I did to improve performance score on Lighthouse
yayoc
2
2.8k
Other Decks in Programming
See All in Programming
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
2
440
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
240
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
740
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
1.8k
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.6k
Unity6.3 AudioUpdate
cova8bitdots
0
110
Claude Code、ちょっとした工夫で開発体験が変わる
tigertora7571
0
200
AIに任せる範囲を安全に広げるためにやっていること
fukucheee
0
110
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
650
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
210
文字コードの話
qnighy
44
17k
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
210
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
60
42k
GitHub's CSS Performance
jonrohan
1032
470k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
130
Statistics for Hackers
jakevdp
799
230k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
340
KATA
mclloyd
PRO
35
15k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
300
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Transcript
Practical FlowType @yayoc
Hello! I am Nobuhide Yayoshi 弥吉修英 You can find me
at @yayoc Frontend engineer, iOS At Fast Retailing
https://flow.org/
“ A static type checker for JavaScript Made By FB
Easy to adopt, easy to leave
Why Type Safety? ⊙ Efficient team development ⊙ Writing code
with confident ⊙ Documentable
Flow Type for Redux
Actions
Action Type with Union Type
Action Type Alias With Generics
Action Type Alias With Generics
$Exact
Without $Exact
Without $Exact
With $Exact
Reducer
Maybe, Optional
Refinements
$Exact Spread Object Issue! http://qiita.com/stomita/items/24a7d223acdc6a8715f4 https://github.com/facebook/flow/issues/2405
Flow Type for Class
Model Promise immutability
Model Promise immutability [flow] property `username` (user.js:20:7) Covariant property `username`
incompatible with contravariant use in assignment of property `username`
Model Promise immutability
Actions as Immutable
Flow Type for React Component
React PropTypes or Flow?
Components Prefer using Generic Style
Components Prefer using Generic Style
Components Prefer using Generic Style
React Component with $PropertyTypes
Adding Props With HOC
Adding Props With HOC
Adding Props With HOC
Error Case Adding Props With HOC
Other tips
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
Flow-coverage-report https://github.com/rpl/flow-coverage-report
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
Swagger Flow Type A Swagger file has more than 8000
lines Writing Type Definitions manually is HARD
https://github.com/yayoc/swagger-to-flowtype https://github.com/yayoc/swagger-to-flowtype https://medium.com/@n_yayoshi/swagger-to-flowtype-generates-flow-type-aliases-8fab67776a4
None
swagger.yaml
flowtype.js
Conclusion ⊙ Utility types are useful ◦ $Exact ◦ $PropertyType
◦ Class ◦ Immutability ⊙ Prefer Flow than Proptypes ⊙ Prefer Generic Component ⊙ swagger-to-flowtype is useful
型安全 is Rock
We are hiring!!!
Thanks! Any questions? You can find me at @yayoc &
[email protected]
Credits Special thanks to all the people who made and
released these awesome resources for free: ⊙ Presentation template by SlidesCarnival ⊙ Photographs by Unsplash