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
TypeScript tips that could save your life
Search
Lucas Santos
May 11, 2023
Technology
0
220
TypeScript tips that could save your life
Lucas Santos
May 11, 2023
Tweet
Share
More Decks by Lucas Santos
See All by Lucas Santos
The Hitchhiker's Guide for an Amazing API with TypeScript
khaosdoctor
0
110
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
200
The future of JavaScript
khaosdoctor
0
62
É hora de falar sobre Deno
khaosdoctor
0
79
JS Software testing for beginners
khaosdoctor
0
90
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
45
The Dark Side of JavaScript
khaosdoctor
0
82
Integrating Containers Into JavaScript
khaosdoctor
0
72
Entendendo o ecossistema de containers
khaosdoctor
1
1k
Other Decks in Technology
See All in Technology
A Gentle Introduction to Transformers
keio_smilab
PRO
1
170
チームメンバー迷わないIaC設計
hayama17
5
3.8k
Digitization部 紹介資料
sansan33
PRO
1
7k
管理者向けGitHub Enterpriseの運用Tips紹介: 人にもAIにも優しいプラットフォームづくり
yuriemori
0
130
作りっぱなしで終わらせない! 価値を出し続ける AI エージェントのための「信頼性」設計 / Designing Reliability for AI Agents that Deliver Continuous Value
aoto
PRO
1
140
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
7
7.1k
Lookerの最新バージョンv26.2がやばい話
waiwai2111
1
160
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
14k
Devinを導入したら予想外の人たちに好評だった
tomuro
0
890
バクラクのSREにおけるAgentic AIへの挑戦/Our Journey with Agentic AI
taddy_919
2
1k
男(監査)はつらいよ - Policy as CodeからAIエージェントへ
ken5scal
5
730
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
22k
Featured
See All Featured
It's Worth the Effort
3n
188
29k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
770
We Are The Robots
honzajavorek
0
190
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
950
How to Talk to Developers About Accessibility
jct
2
140
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
460
Context Engineering - Making Every Token Count
addyosmani
9
740
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.8k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Building an army of robots
kneath
306
46k
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Transcript
TypeScript tips that could save your life
who am I_ {twitter, youtube, linkedin…}.lsantos.dev software engineer_
[email protected]
typescript can be tricky sometimes
so let's cut to the chase_
tsconfig extension_
None
None
None
None
None
It's not only for bases
It's not only for bases
type_ testing
one native way: *.typetest.ts files
one native way: *.typetest.ts files https://lsantos.dev/keychain-pull
the (more) native way
vitest
tsd https://lsantos.dev/tsd-lib
move errors to types
instead of this
do this
branded types_
UUIDs are the perfect example
to brand a type
to brand a type
even better
but well… Why isn't this working
but well… Why isn't this working To be continued…
but there's another example
type guards_
but well… Why isn't this working
now we have something
but this if…
assertion functions
assertion out of tests
understand your enums_
enums produce valid JavaScript
enums produce valid JavaScript
numeric enums
string enums
constant enums
constant enums
obrigado_ lsantos.dev