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
78
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
旧から新へ: 大規模ウェブクローラの Perl から Go への移行 / YAPC::Fukuoka 2025
motemen
3
880
Proxmox × HCP Terraformで始めるお家プライベートクラウド
lamaglama39
1
200
AI × クラウドで シイタケの収穫時期を判定してみた
lamaglama39
0
250
コンピューティングリソース何を使えばいいの?
tomokusaba
1
160
Flutter DevToolsで発見! 本番アプリのパフォーマンス問題と改善の実践
goto_tsl
1
590
【M3】攻めのセキュリティの実践!プロアクティブなセキュリティ対策の実践事例
axelmizu
0
150
エンジニアにとってコードと並んで重要な「データ」のお話 - データが動くとコードが見える:関数型=データフロー入門
ismk
0
520
コミュニティと共に変化する 私とFusicの8年間
ayasamind
0
480
なぜインフラコードのモジュール化は難しいのか - アプリケーションコードとの本質的な違いから考える
mizzy
52
16k
Lazy Constant - finalフィールドの遅延初期化
skrb
0
200
X-Ray SDKとDaemonのサポート終了と移⾏ガイド
o11yfes2023
0
110
コード1ミリもわからないけど Claude CodeでFigjamプラグインを作った話
abokadotyann
1
160
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
36
7k
Faster Mobile Websites
deanohume
310
31k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
A Tale of Four Properties
chriscoyier
162
23k
Bash Introduction
62gerente
615
210k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
Docker and Python
trallard
46
3.6k
The Cost Of JavaScript in 2023
addyosmani
55
9.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
Typedesign – Prime Four
hannesfritz
42
2.9k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
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