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
35
As Dores de uma Fintech
sibelius
1
300
Woovi - Safe Coding Practices
sibelius
1
77
⛔ No Cloud: how Woovi moved from the Cloud to its own servers
sibelius
1
730
React Colocation
sibelius
2
300
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
20260305_【白金鉱業】分析者が地理情報を武器にするための軽量なアドホック分析環境
yucho147
1
170
Data Hubグループ 紹介資料
sansan33
PRO
0
2.8k
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.1k
越境する組織づくり ─ 多様性を前提にしたチームビルディングとリードの実践知
kido_engineer
1
110
Eight Engineering Unit 紹介資料
sansan33
PRO
1
6.9k
OpenClawで回す組織運営
jacopen
2
400
Serverless Agent Architecture on Azure / serverless-agent-on-azure
miyake
1
150
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
72k
組織のSREを推進するためのPlatform EngineeringとEKS / Platform Engineering and EKS to drive SRE in your organization
chmikata
0
180
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
5
1.1k
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
Claude Codeの進化と各機能の活かし方
oikon48
10
2.9k
Featured
See All Featured
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
74
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
67
37k
Rails Girls Zürich Keynote
gr2m
96
14k
Practical Orchestrator
shlominoach
191
11k
Embracing the Ebb and Flow
colly
88
5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
94
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
79
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
63
Automating Front-end Workflow
addyosmani
1370
200k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
The World Runs on Bad Software
bkeepers
PRO
72
12k
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