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
270
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
650
React Colocation
sibelius
1
260
The Frontend Dichotomy
sibelius
4
700
React Native Bridges Architectures
sibelius
1
1.3k
What's next?
sibelius
2
630
ReactConfBR - Is Relay Modern the Future?
sibelius
2
880
Other Decks in Technology
See All in Technology
Monorepo Error Management: Automated Runbooks and Team-Targeted Alert Distribution
biwashi
1
150
kotlin-lsp を Emacs で使えるようにしてみた / use kotlin-lsp in Emacs
nabeo
0
120
AIにどこまで任せる?実務で使える(かもしれない)AIエージェント設計の考え方
har1101
2
470
CSSの最新トレンド Ver.2025
tonkotsuboy_com
11
4.4k
マルチテナント+マルチプロダクト SaaS への AI Agent の組み込み方
kworkdev
PRO
2
230
ハッカー視点で学ぶサイバー攻撃と防御の基本
nomizone
3
1.5k
Kotlinで学ぶ 代数的データ型
ysknsid25
5
1k
AIコーディング新時代を生き残るための試行錯誤 / AI Coding Survival Guide
tomohisa
8
11k
「どこにある?」の解決。生成AI(RAG)で効率化するガバメントクラウド運用
toru_kubota
2
230
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
7.1k
評価の納得感を2段階高める「構造化フィードバック」
aloerina
1
130
dbt Cloudの新機能を紹介!データエンジニアリングの民主化:GUIで操作、SQLで管理する新時代のdbt Cloud
sagara
0
180
Featured
See All Featured
Designing for Performance
lara
609
69k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
42
2.4k
Git: the NoSQL Database
bkeepers
PRO
430
65k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
Raft: Consensus for Rubyists
vanstee
138
7k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.6k
Site-Speed That Sticks
csswizardry
10
620
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
14
1.5k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Stop Working from a Prison Cell
hatefulcrawdad
269
20k
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