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
210
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
92
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
190
The future of JavaScript
khaosdoctor
0
60
É hora de falar sobre Deno
khaosdoctor
0
73
JS Software testing for beginners
khaosdoctor
0
77
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
42
The Dark Side of JavaScript
khaosdoctor
0
76
Integrating Containers Into JavaScript
khaosdoctor
0
68
Entendendo o ecossistema de containers
khaosdoctor
1
970
Other Decks in Technology
See All in Technology
從裝潢設計圖到 Home Assistant:打造智慧家庭的實戰與踩坑筆記
kewang
0
160
今、MySQLのバックアップを作り直すとしたら何がどう良いのかを考える旅
yoku0825
0
260
バグと向き合い、仕組みで防ぐ
____rina____
0
270
自己的售票系統自己做!
eddie
0
440
Design and implementation of "Markdown to Google Slides" / phpconfuk 2025
k1low
1
400
QAセントラル組織が運営する自動テストプラットフォームの課題と現状
lycorptech_jp
PRO
0
390
ググるより、AIに聞こう - Don’t Google it, ask AI
oikon48
0
870
エンジニアにとってコードと並んで重要な「データ」のお話 - データが動くとコードが見える:関数型=データフロー入門
ismk
0
490
CDKの魔法を少し解いてみる ― synth・build・diffで覗くIaCの裏側 ―
takahumi27
1
150
『HOWはWHY WHATで判断せよ』 〜『ドメイン駆動設計をはじめよう』の読了報告と、本質への探求〜
panda728
PRO
5
1.6k
Post-AIコーディング時代のエンジニア生存戦略
shinoyu
0
280
Flutterで実装する実践的な攻撃対策とセキュリティ向上
fujikinaga
2
380
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Navigating Team Friction
lara
190
15k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Bash Introduction
62gerente
615
210k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
970
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
BBQ
matthewcrist
89
9.9k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
The World Runs on Bad Software
bkeepers
PRO
72
12k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Done Done
chrislema
186
16k
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