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
160
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
79
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
180
The future of JavaScript
khaosdoctor
0
49
É hora de falar sobre Deno
khaosdoctor
0
63
JS Software testing for beginners
khaosdoctor
0
58
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
33
The Dark Side of JavaScript
khaosdoctor
0
67
Integrating Containers Into JavaScript
khaosdoctor
0
53
Entendendo o ecossistema de containers
khaosdoctor
1
870
Other Decks in Technology
See All in Technology
データの品質が低いと何が困るのか
kzykmyzw
4
550
家電アプリ共通PF "Linova" のAPI利用とPostman活用事例ご紹介
yukiogawa
0
110
[2025-02-07]生成AIで変える問い合わせの未来 〜チームグローバル化の香りを添えて〜
tosite
1
220
CNAPPから考えるAWSガバナンスの実践と最適化
nrinetcom
PRO
1
410
『AWS Distinguished Engineerに学ぶ リトライの技術』 #ARC403/Marc Brooker on Try again: The tools and techniques behind resilient systems
quiver
0
120
Googleマップ/Earthが一般化した 地図タイルのイマ
mapconcierge4agu
1
180
アジャイル開発とスクラム
araihara
0
140
Classmethod AI Talks(CATs) #15 司会進行スライド(2025.02.06) / classmethod-ai-talks-aka-cats_moderator-slides_vol15_2025-02-06
shinyaa31
0
140
Postman Vaultを使った秘密情報の安全な管理
nagix
3
230
Larkご案内資料
customercloud
PRO
0
410
Ask! NIKKEIの運用基盤と改善に向けた取り組み / NIKKEI TECH TALK #30
kaitomajima
1
390
AIプロダクト開発から得られた知見 - 2025年1月版
takaakikakei
0
180
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
44
13k
Unsuck your backbone
ammeep
669
57k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
A better future with KSS
kneath
238
17k
Side Projects
sachag
452
42k
Why Our Code Smells
bkeepers
PRO
335
57k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
31
2.1k
Designing on Purpose - Digital PM Summit 2013
jponch
117
7.1k
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