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
59
As Dores de uma Fintech
sibelius
1
310
Woovi - Safe Coding Practices
sibelius
1
92
⛔ No Cloud: how Woovi moved from the Cloud to its own servers
sibelius
1
780
React Colocation
sibelius
2
340
The Frontend Dichotomy
sibelius
5
760
React Native Bridges Architectures
sibelius
2
1.3k
What's next?
sibelius
3
670
ReactConfBR - Is Relay Modern the Future?
sibelius
3
960
Other Decks in Technology
See All in Technology
Head First モブプログラミング / Head First Mobprogramming
takaking22
10
12k
Apache Icebergインフラストラクチャ:ストレージ・カタログ・エンジンの選択肢とClouderaプラットフォームでの実装
tsugiyama
0
120
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
230
AIコーディングの次。コードレビューと理解負荷を解消して組織の開発生産性を高める
moongift
PRO
2
2.7k
MulticaとPi Coding Agentで、小規模OSSを30本同時運用した流れ
eiei114
0
130
20260804_Q4AzureUpdateBite_FabricDataAgentの精度を高める設計.pdf
matayuuu
1
150
ハーレムエンジニアリング
kazuma777777
0
190
20260807_第6回_関東kaggler会LT_claw系bot xangiと始める、"寂しくない" kaggle
sugupoko
0
360
FPGAが実現する遠方宇宙の高空間分解能天体撮影 -大型地上望遠鏡の視力を補正する「補償光学」とは?-
komei_mt
0
540
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
9.3k
Sets in Go
ramalho
1
1.1k
20分でわかるセキュアAPI
nwiizo
2
310
Featured
See All Featured
We Are The Robots
honzajavorek
0
300
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
580
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Visualization
eitanlees
152
17k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
480
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
430
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
350
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Balancing Empowerment & Direction
lara
6
1.2k
Why Our Code Smells
bkeepers
PRO
340
58k
Mind Mapping
helmedeiros
PRO
1
320
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