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
170
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
83
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
180
The future of JavaScript
khaosdoctor
0
54
É hora de falar sobre Deno
khaosdoctor
0
67
JS Software testing for beginners
khaosdoctor
0
64
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
38
The Dark Side of JavaScript
khaosdoctor
0
71
Integrating Containers Into JavaScript
khaosdoctor
0
57
Entendendo o ecossistema de containers
khaosdoctor
1
890
Other Decks in Technology
See All in Technology
TopAppBar Composableをカスタムする
hunachi
0
170
Amazon CloudWatch Application Signals ではじめるバーンレートアラーム / Burn rate alarm with Amazon CloudWatch Application Signals
ymotongpoo
5
310
All You Need Is Kusa 〜Slackデータで始めるデータドリブン〜
jonnojun
0
140
Webアプリを Lambdaで動かすまでに考えること / How to implement monolithic Lambda Web Application
_kensh
7
1.2k
低レイヤを知りたいPHPerのためのCコンパイラ作成入門 / Building a C Compiler for PHPers Who Want to Dive into Low-Level Programming
tomzoh
0
210
古き良き Laravel のシステムは関数型スタイルでリファクタできるのか
leveragestech
1
630
Would you THINK such a demonstration interesting ?
shumpei3
1
160
“パスワードレス認証への道" ユーザー認証の変遷とパスキーの関係
ritou
1
430
SRE NEXT CfP チームが語る 聞きたくなるプロポーザルとは / Proposals by the SRE NEXT CfP Team that are sure to be accepted
chaspy
1
570
Ops-JAWS_Organizations小ネタ3選.pdf
chunkof
2
120
SDカードフォレンジック
su3158
0
100
AIで進化するソフトウェアテスト:mablの最新生成AI機能でQAを加速!
mfunaki
0
120
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
229
18k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.3k
4 Signs Your Business is Dying
shpigford
183
22k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
650
Building Applications with DynamoDB
mza
94
6.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
390
A better future with KSS
kneath
239
17k
Java REST API Framework Comparison - PWX 2021
mraible
30
8.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.3k
Principles of Awesome APIs and How to Build Them.
keavy
126
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