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
29
As Dores de uma Fintech
sibelius
1
290
Woovi - Safe Coding Practices
sibelius
1
73
⛔ No Cloud: how Woovi moved from the Cloud to its own servers
sibelius
1
720
React Colocation
sibelius
2
300
The Frontend Dichotomy
sibelius
5
720
React Native Bridges Architectures
sibelius
2
1.3k
What's next?
sibelius
3
640
ReactConfBR - Is Relay Modern the Future?
sibelius
3
930
Other Decks in Technology
See All in Technology
持続可能な開発のためのミニマリズム
sansantech
PRO
3
430
AI Agent Agentic Workflow の可観測性 / Observability of AI Agent Agentic Workflow
yuzujoe
5
2.2k
アウトプットはいいぞ / output_iizo
uhooi
0
140
Node vs Deno vs Bun 〜推しランタイムを見つけよう〜
kamekyame
1
570
Introduction to Sansan Meishi Maker Development Engineer
sansan33
PRO
0
340
Hardware/Software Co-design: Motivations and reflections with respect to security
bcantrill
1
220
Git Training GitHub
yuhattor
1
220
Kaggleコンペティション「MABe Challenge - Social Action Recognition in Mice」振り返り
yu4u
1
650
Behind the Stream - How AbemaTV Engineers Build Video Apps at Scale
ygoto3
0
120
会社紹介資料 / Sansan Company Profile
sansan33
PRO
13
400k
サラリーマンソフトウェアエンジニアのキャリア
yuheinakasaka
42
20k
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
64k
Featured
See All Featured
The SEO Collaboration Effect
kristinabergwall1
0
340
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
150
Building AI with AI
inesmontani
PRO
1
640
Joys of Absence: A Defence of Solitary Play
codingconduct
1
270
How Software Deployment tools have changed in the past 20 years
geshan
0
31k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
57
The World Runs on Bad Software
bkeepers
PRO
72
12k
Discover your Explorer Soul
emna__ayadi
2
1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
99
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.4k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
84
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