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
Types in Real Life
Search
Sibelius Seraphini
July 13, 2018
Technology
310
4
Share
Types in Real Life
Practical approve to types in javascript
Sibelius Seraphini
July 13, 2018
More Decks by Sibelius Seraphini
See All by Sibelius Seraphini
Por que criar uma nova Fintech?
sibelius
1
48
As Dores de uma Fintech
sibelius
1
310
Woovi - Safe Coding Practices
sibelius
1
85
⛔ No Cloud: how Woovi moved from the Cloud to its own servers
sibelius
1
750
React Colocation
sibelius
2
320
The Frontend Dichotomy
sibelius
5
750
React Native Bridges Architectures
sibelius
2
1.3k
What's next?
sibelius
3
650
ReactConfBR - Is Relay Modern the Future?
sibelius
3
960
Other Decks in Technology
See All in Technology
Javaコミュニティをもっと楽しむための9箇条
takasyou
0
1.1k
「気づいたら仕事が終わっている」バクラクAIエージェント本番運用の裏側 / layerx-bakuraku-aie2026
yuya4
15
7.5k
GoとSIMDとWasmの今。
askua
3
470
大学生が本気でDatabricksを活用してDiscordサークルをデータ駆動させてみた
phantomjuju
1
330
OpenID Connectによるサービス間連携
takesection
0
150
探して_入れて_作って_使う_Agent_Skills___LT.pdf
peintangos
2
150
はじめてのDatadog
kairim0
0
260
Java正規表現エンジン(NFA)の仕組みと パフォーマンスを維持するための最適化手法
takeuchi_132917
0
170
地元にいないローカルオーガナイザーの立ち回り
uvb_76
1
440
製造業のクラウド活用最適解〜AI,DXを加速するデータ基盤の作り方〜
hamadakoji
0
300
AI駆動開発でなんでもハンズオン環境をつくってみた
yoshimi0227
0
200
AI時代の私の技術インプットとアウトプット術
tonkotsuboy_com
16
8.2k
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Mobile First: as difficult as doing things right
swwweet
225
10k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
590
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Music & Morning Musume
bryan
47
7.2k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
560
Statistics for Hackers
jakevdp
799
230k
Facilitating Awesome Meetings
lara
57
6.9k
Transcript
Types in Real Life How to improve your dev workflow
Sibelius Seraphini
Sibelius Seraphini @sibelius @sseraphini 2
- Motivation - Basics - Sum types - Generics -
REST api study case - React - Redux - Utilities Outline 3
Type System in JS 4
- Less bugs - More maintainability - Type Driven Development
Motivation 5
- Better tools support - Code completion - Refactor -
Documentation - Jump to definition Motivation 6
- Types are set of values - string - 'a'
| 'b' | 'c' | ... - number - 1 | 2 | 3 | ... - boolean - true | false - function - string -> boolean | ... - object - { a: string, b: number } | ... What are Types? 7
Typing a variable 8
Typing a function 9
Typing an object 10
Nominal Typing 11 - C++, Java, Swift
Structural Typing 12 - OCaml, Haskell, Elm
Typing an array 13
Sum/Union Type 14
Intersection Type 15
- How to type a function that can be used
for any type of array (int[], string[], number[])? Generics 16
Generics 17
18 Optional type
- type the input - api body payload - headers
- query string Typing a REST API 19
- type the output (response) - Get a json output
of a REST api - Transform json to types - https://transform.now.sh/json-to-flo w-types/ Typing a REST API 20
Typing a REST api 21
Typing a REST api 22
Typing a React Component 23
Typing a React Component (TS) 24
Typing a React Component 25
Typing a HOC 26
Typing Redux 27
Typing Redux 28
Typing Redux 29
Flow Type Utilities 30
TypeScript Utilities Mapped Types 31
TypeScript Utilities Conditional Typing 32
Resources 33 - https://github.com/entria/guidelines/tree/ master/flow - https://flow.org/en/docs/lang/ - https://www.typescriptlang.org/docs/ho me.html
- https://github.com/fantasyland/fantasy-l and - https://github.com/gcanti/flow-static-land
Resources 34 - https://medium.com/javascript-scene/m aster-the-javascript-interview-what-is-fu nctional-programming-7f218c68b3a0 - https://medium.com/@matthiasak/state- of-the-union-js-d664bdbffd14 -
https://mitpress.mit.edu/books/types-an d-programming-languages - https://github.com/niieani/typescript-vs-fl owtype
Resources 35 - https://transform.now.sh/json-to-flow-typ es/
I didn't mention 36 - More about Type Theory -
Functional Programming - Types + Functional - Fantasy Land specs - Realworld problems and solutions
Sibelius