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
4
300
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
Por que criar uma nova Fintech?
sibelius
1
38
As Dores de uma Fintech
sibelius
1
300
Woovi - Safe Coding Practices
sibelius
1
78
⛔ No Cloud: how Woovi moved from the Cloud to its own servers
sibelius
1
730
React Colocation
sibelius
2
310
The Frontend Dichotomy
sibelius
5
730
React Native Bridges Architectures
sibelius
2
1.3k
What's next?
sibelius
3
640
ReactConfBR - Is Relay Modern the Future?
sibelius
3
940
Other Decks in Technology
See All in Technology
Kubernetesの「隠れメモリ消費」によるNode共倒れと、Request適正化という処方箋
g0xu
0
150
AgentCoreとLINEを使った飲食店おすすめアプリを作ってみた
yakumo
2
260
俺の/私の最強アーキテクチャ決定戦開催 ― チームで新しいアーキテクチャに適合していくために / 20260322 Naoki Takahashi
shift_evolve
PRO
1
460
「通るまでRe-run」から卒業!落ちないテストを書く勘所
asumikam
2
780
やさしいとこから始めるGitHubリポジトリのセキュリティ
tsubakimoto_s
3
1.9k
VSCode中心だった自分がターミナル沼に入門した話
sanogemaru
0
780
Phase02_AI座学_応用
overflowinc
0
3.2k
夢の無限スパゲッティ製造機 #phperkaigi
o0h
PRO
0
380
PostgreSQL 18のNOT ENFORCEDな制約とDEFERRABLEの関係
yahonda
0
140
非同期・イベント駆動処理の分散トレーシングの繋げ方
ichikawaken
1
150
DMBOKを使ってレバレジーズのデータマネジメントを評価した
leveragestech
0
430
スケーリングを封じられたEC2を救いたい
senseofunity129
0
110
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
230
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
490
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
93
Designing for Performance
lara
611
70k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
160
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
240
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
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