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
Keep alive your typescript definitions using Zod
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Luca Del Puppo
January 16, 2023
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Keep alive your typescript definitions using Zod
Luca Del Puppo
January 16, 2023
More Decks by Luca Del Puppo
See All by Luca Del Puppo
Aware dependencies using Nx Graph
puppo
0
99
Prisma the ORM that node was waiting for
puppo
0
130
How to scale up your projects like a pro
puppo
0
150
Alive, Tipi Sopravvisuti
puppo
0
150
ReactDay 2022 - Unit testing
puppo
0
130
How to scale up your angular projects like a pro
puppo
0
210
Prisma in the Air
puppo
0
470
Can typescript definitions survive even at runtime?
puppo
0
160
Is it possible to build your UI components using only web components?
puppo
0
110
Other Decks in Programming
See All in Programming
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
110
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
480
えっ!!コードを読まずに開発を!?
hananouchi
0
190
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
610
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
240
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
250
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.4k
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
100
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
140
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
2.3k
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
460
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
580
Featured
See All Featured
For a Future-Friendly Web
brad_frost
183
10k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
230
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
460
What's in a price? How to price your products and services
michaelherold
247
13k
How to build a perfect <img>
jonoalderson
1
5.8k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
220
Ethics towards AI in product and experience design
skipperchong
2
330
Color Theory Basics | Prateek | Gurzu
gurzu
0
390
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Docker and Python
trallard
47
3.9k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
450
Transcript
Keep alive your typescript definitions using Zod Luca Del Puppo
Who I am Luca Del Puppo (aka Puppo)
Full-Stack Developer @ Flowing a Claranet Company and Microsoft MVP @puppo92 https://www.linkedin.com/in/lucadelpuppo/
[email protected]
Typescript journey 1
10 years ago
The developers reaction
interface CustomerModel { id: number; name: string; email: string; phone:
string; } Interfaces
type CustomerModel = { id: number; name: string; email: string;
phone: string; }; Types
HTTP Request
But after a while…
➔ Typescript enables type check but on BUILT - TIME
➔ After the build all your types disappears ➔ After the build all your considerations about types dissolve Why?
Prevent ugly mistakes 2
Zod is your super hero
import { z } from ‘zod’; const CustomerSchema = z.object({
id: z.number(), name: z.string(), email: z.string(), phone: z.string(), }); Schema
import { TypeOf } from ‘zod'; type CustomerModel = TypeOf<typeof
CustomerSchema>; Convert to type
const res = CustomerSchema.parse({ id: 1, name: 'John Doe', email:
'
[email protected]
', phone: '555-555-5555' }); Parse method
➔ Parse throws an Error ➔ ZodError is the right
error to check ➔ ZodError contains all the issues that describe the errors Something wrong?
Do you hate exceptions? use safeParse
safeParse Success ➔ success: true ➔ data: Output Error ➔
success: false ➔ error: ZodError
Benefits of using Zod
Create a layer between your app and the outside V
a l i d a t i o n HTTP socket.io
Demo 3
Conclusion 4
➔ Typescript is awesome, but it’s good only on built
time ➔ Create a validation layer between your app and the outside • Prevent execution of code with wrong data • You can get notifications if something is changed ➔ Using Zod, you can guarantee your types, both built-time and run-time Conclusion
CODE SLIDE
Thanks! That’s All! Luca Del Puppo @puppo92 https://www.linkedin.com/in/lucadelpuppo/
[email protected]