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
320
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
56
As Dores de uma Fintech
sibelius
1
310
Woovi - Safe Coding Practices
sibelius
1
90
⛔ No Cloud: how Woovi moved from the Cloud to its own servers
sibelius
1
770
React Colocation
sibelius
2
330
The Frontend Dichotomy
sibelius
5
750
React Native Bridges Architectures
sibelius
2
1.3k
What's next?
sibelius
3
660
ReactConfBR - Is Relay Modern the Future?
sibelius
3
960
Other Decks in Technology
See All in Technology
A Bag-of-Documents Model for Query Specificity
dtunkelang
0
160
現場で使える AWS DevOps Agent 活用ノウハウ - Release Management 機能の検証結果を添えて / AWS DevOps Agent Release Management and Know-How
kinunori
4
750
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
53k
SRENEXT_2026_Chairs__Talks_in_Tamachi.sre.pdf
srenext
1
170
AI Agent を本番環境へ―― Microsoft Foundry × Azure Serverless で作る Enterprise-Ready な基盤
shibayan
PRO
1
820
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
110k
QAタスクをスキル化したいときに考えること
aomoriringo
0
130
書籍セキュアAPIについて
riiimparm
0
380
自己解決や回答速度を上げる、サポート業務へのAIの組み込み方【SORACOM Discovery 2026】
soracom
PRO
0
100
Claude Mythos、Fable...フロンティアAIの最新動向と企業のセキュリティ対策
flatt_security
0
170
データ活用研修 データマネジメント【MIXI 26新卒技術研修】
mixi_engineers
PRO
4
780
「待ち時間」の消滅と「自我消耗」の加速:生成AI時代のエンジニアを救うメンタル・リソース管理
poropinai1966
0
320
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
How STYLIGHT went responsive
nonsquared
100
6.2k
Chasing Engaging Ingredients in Design
codingconduct
0
240
Building Adaptive Systems
keathley
44
3.1k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
560
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
600
Mind Mapping
helmedeiros
PRO
1
290
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
430
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Paper Plane (Part 1)
katiecoart
PRO
1
9.9k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
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