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
yayoc
July 14, 2017
Programming
820
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Practical Flow Type
Slides presented at gotanda.js
Nobuhide Yayoshi
yayoc
July 14, 2017
More Decks by yayoc
See All by yayoc
optional chainingの話
yayoc
0
300
Proxy's Black Magic
yayoc
0
230
What I did to improve performance score on Lighthouse
yayoc
2
2.8k
Other Decks in Programming
See All in Programming
プロポーザルを書いてもらう
pvcresin
0
570
リアルな遅延を測る仕様
kota_yata
1
120
What's New in Android 2026
veronikapj
0
270
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
350
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
450
引き算の組織 ― アウトカムとAIに全振りするために辞めたこと ― / Organization by Subtraction
hirokiyamamoto14
PRO
0
270
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
130
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
4
1.7k
Hono + Inertia + React で LP を構築した話
oukayuka
2
110
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
2
320
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
200
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
250
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
55
10k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Google's AI Overviews - The New Search
badams
0
1.1k
Are puppies a ranking factor?
jonoalderson
2
3.8k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Site-Speed That Sticks
csswizardry
13
1.5k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
510
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
370
Raft: Consensus for Rubyists
vanstee
141
7.6k
How GitHub (no longer) Works
holman
316
150k
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