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
150
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
73
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
180
The future of JavaScript
khaosdoctor
0
47
É hora de falar sobre Deno
khaosdoctor
0
63
JS Software testing for beginners
khaosdoctor
0
53
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
33
The Dark Side of JavaScript
khaosdoctor
0
64
Integrating Containers Into JavaScript
khaosdoctor
0
52
Entendendo o ecossistema de containers
khaosdoctor
1
840
Other Decks in Technology
See All in Technology
【技術書典17】OpenFOAM(自宅で極める流体解析)2次元円柱まわりの流れ
kamakiri1225
0
220
カメラを用いた店内計測におけるオプトインの仕組みの実現 / ai-optin-camera
cyberagentdevelopers
PRO
1
120
ガバメントクラウド単独利用方式におけるIaC活用
techniczna
3
270
「 SharePoint 難しい」ってよく聞くけど、そんなに言うなら8歳の息子に試してもらった
taichinakamura
1
630
[AWS JAPAN 生成AIハッカソン] Dialog の紹介
yoshimi0227
0
150
pandasはPolarsに性能面で追いつき追い越せるのか
vaaaaanquish
4
4.6k
ネット広告に未来はあるか?「3rd Party Cookie廃止とPrivacy Sandboxの効果検証の裏側」 / third-party-cookie-privacy
cyberagentdevelopers
PRO
1
130
AIを駆使したゲーム開発戦略: 新設AI組織の取り組み / sge-ai-strategy
cyberagentdevelopers
PRO
1
130
話題のGraphRAG、その可能性と課題を理解する
hide212131
4
1.5k
生成AIとAWS CDKで実現! 自社ブログレビューの効率化
ymae
2
330
Product Engineer Night #6プロダクトエンジニアを育む仕組み・施策
hacomono
PRO
1
470
omakaseしないための.rubocop.yml のつくりかた / How to Build Your .rubocop.yml to Avoid Omakase #kaigionrails
linkers_tech
3
740
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
93
13k
Making the Leap to Tech Lead
cromwellryan
132
8.9k
Build The Right Thing And Hit Your Dates
maggiecrowley
32
2.4k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.8k
Into the Great Unknown - MozCon
thekraken
31
1.5k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
14
1.9k
Code Reviewing Like a Champion
maltzj
519
39k
Code Review Best Practice
trishagee
64
17k
How to Ace a Technical Interview
jacobian
275
23k
A Modern Web Designer's Workflow
chriscoyier
692
190k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.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