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
3
260
Types in Real Life
Practical approve to types in javascript
Sibelius Seraphini
July 13, 2018
Tweet
Share
More Decks by Sibelius Seraphini
See All by Sibelius Seraphini
⛔ No Cloud: how Woovi moved from the Cloud to its own servers
sibelius
0
540
React Colocation
sibelius
1
230
The Frontend Dichotomy
sibelius
4
680
React Native Bridges Architectures
sibelius
1
1.3k
What's next?
sibelius
2
610
ReactConfBR - Is Relay Modern the Future?
sibelius
2
850
Other Decks in Technology
See All in Technology
JAWS-UG20250116_iOSアプリエンジニアがAWSreInventに行ってきた(真面目編)
totokit4
0
150
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
8k
デジタルアイデンティティ人材育成推進ワーキンググループ 翻訳サブワーキンググループ 活動報告 / 20250114-OIDF-J-EduWG-TranslationSWG
oidfj
0
560
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
170
Formal Development of Operating Systems in Rust
riru
1
420
あなたの知らないクラフトビールの世界
miura55
0
140
AWS Community Builderのススメ - みんなもCommunity Builderに応募しよう! -
smt7174
0
200
Unsafe.BitCast のすゝめ。
nenonaninu
0
200
RubyでKubernetesプログラミング
sat
PRO
4
160
VPC Block Public AccessとCloudFrontVPCオリジンによって何が変わるのか?
hatahata021
2
100
2025年のARグラスの潮流
kotauchisunsun
0
870
トラブルシュートを楽しもう (wakamonog meeting 15)
recuraki
1
330
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
A Tale of Four Properties
chriscoyier
157
23k
What's in a price? How to price your products and services
michaelherold
244
12k
Embracing the Ebb and Flow
colly
84
4.5k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Adopting Sorbet at Scale
ufuk
74
9.2k
BBQ
matthewcrist
85
9.4k
We Have a Design System, Now What?
morganepeng
51
7.3k
The World Runs on Bad Software
bkeepers
PRO
66
11k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
174
51k
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