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
140
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
45
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
170
The future of JavaScript
khaosdoctor
0
37
É hora de falar sobre Deno
khaosdoctor
0
63
JS Software testing for beginners
khaosdoctor
0
37
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
31
The Dark Side of JavaScript
khaosdoctor
0
55
Integrating Containers Into JavaScript
khaosdoctor
0
48
Entendendo o ecossistema de containers
khaosdoctor
1
790
Other Decks in Technology
See All in Technology
Four Keysだけじゃ足りなくない? 〜俺たちだけのFour Keysを探して〜
rinchsan
2
1.2k
RDS for Db2 はじめの一歩・作り方編 #1 /20240628-RDSforDb2-dojo
mayumihirano
0
160
プロダクト拡大フェーズでプロダクト検証サイクル効率化を目指す過程で見えたもの / Streamlining Product Validation in Growth Phase
kakehashi
4
2.2k
OODAふりかえり 何って…ただ毎スプリント、違うふりかえり手法を採用してるだけだが? / Retrospectives with OODA
kakehashi
12
2.6k
Oracle Modern Data Platform Reference Architecture (Autonomous Data Warehouse編)
oracle4engineer
PRO
0
500
「開発生産性を上げる改善」って儲かるの?に答えられるようにする / Is development productivity profitable?
i35_267
18
7.2k
マルチエージェントで性能が上がったText-to-SQLのいま/Text-to-SQL
yoshidashingo
2
1.3k
LeanとDevOpsのためにE2Eテストができること
magicpod
4
1.7k
スクラムエッセンス導入3ヶ月のチームに起きた変化
hacomono
PRO
1
120
やさしいITを目指すために
ishity__
0
290
GA technologiesの経営戦略から駆動するデータ基盤構築
pacocat
0
470
新常識! Javascript×AWS Lambdaがアツい!!
watany
3
250
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
457
32k
Practical Orchestrator
shlominoach
184
9.9k
Facilitating Awesome Meetings
lara
44
5.8k
Git: the NoSQL Database
bkeepers
PRO
423
64k
Faster Mobile Websites
deanohume
300
30k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
22
1.8k
The World Runs on Bad Software
bkeepers
PRO
62
10k
GraphQLの誤解/rethinking-graphql
sonatard
58
9.5k
Thoughts on Productivity
jonyablonski
62
4k
Speed Design
sergeychernyshev
3
160
ReactJS: Keep Simple. Everything can be a component!
pedronauck
661
120k
Art, The Web, and Tiny UX
lynnandtonic
290
19k
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