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
86
TypeScript tips that could save your life
Lucas Santos
May 11, 2023
Tweet
Share
More Decks by Lucas Santos
See All by Lucas Santos
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
150
The future of JavaScript
khaosdoctor
0
28
É hora de falar sobre Deno
khaosdoctor
0
62
JS Software testing for beginners
khaosdoctor
0
34
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
30
The Dark Side of JavaScript
khaosdoctor
0
51
Integrating Containers Into JavaScript
khaosdoctor
0
38
Entendendo o ecossistema de containers
khaosdoctor
1
740
gRPC with Node.js
khaosdoctor
0
650
Other Decks in Technology
See All in Technology
エンジニアブランディングチームの KPI / KPI's of engineer branding team
chaspy
1
140
継続的テストモデルを実現するためにスリーアミーゴスを用いた10Xでのシフトレフトの事例
nihonbuson
3
160
Cloud Friendly(?) Jenkins. How we failed to make Jenkins cloud native and what we learned?
onenashev
PRO
0
110
TypeScript Quiz (Encraft #12 Frontend Quiz Night)
uhyo
2
350
サービスメッシュ環境における OpenTelemetry 活用 / OpenTelemetry in Service Mesh
k6s4i53rx
2
840
沒想過的前端錯誤處理可能比你有做的還多
line_developers_tw
PRO
0
2k
XRミーティング 2024-03-20
1ftseabass
PRO
0
100
関数型DDDの理論と実践:「決定を遅らせる」を先につくり、 ビジネスの機動力と価値をあげる
knih
2
470
HoneycombとOpenTelemetryでオブザーバビリティに入門してみる
sumiren
2
150
生成AIの不確実性と向き合うためのオブジェクト指向設計
tkikuchi1002
2
660
生成AIサービスPanorama AIご説明資料
sdt
0
300
8週連続ウェビナー_イチから学ぶFivetran
cmsuzu
0
160
Featured
See All Featured
The Cult of Friendly URLs
andyhume
73
5.6k
Creatively Recalculating Your Daily Design Routine
revolveconf
209
11k
Designing Experiences People Love
moore
135
23k
Art, The Web, and Tiny UX
lynnandtonic
288
19k
Debugging Ruby Performance
tmm1
68
11k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.3k
BBQ
matthewcrist
78
8.7k
Infographics Made Easy
chrislema
237
18k
Why You Should Never Use an ORM
jnunemaker
PRO
50
8.6k
How to train your dragon (web standard)
notwaldorf
71
5.1k
A better future with KSS
kneath
230
16k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
24
2.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