Luca Del Puppo
Luca Del Puppo
I'm a Senior Software Engineer, I love javascript and typescript. In my free time, I love to study new technologies or something about improving myself and do trail running in my love Dolomiti.
Zod === TypeScript, but at Runtime in Your React Applications
React Advanced Conference 2023React Advanced Conference 2023
Recording pending
Zod === TypeScript, but at Runtime in Your React Applications
Many Javascript developers have added typescript to their projects in the last few years. But how many of them are sure of their types at runtime? Can types be guaranteed on runtime too?
Using Zod that can be realized! Let's see together how we can use Zod to improve the awareness of our code during its execution and prevent strange mistakes or a bad user experience.
Zod === Typescript, but at Runtime in Your React Applications
React Summit 2023React Summit 2023
13 min
Zod === Typescript, but at Runtime in Your React Applications
In this talk, I want to show how we can use Zod to guarantee the type in a React Application at runtime. Environment variables, HTTP requests, forms and so on could create troubles in our applications, mainly if they contain unexpected types. Using Zod, we can create schemas to guarantee the types expected in our editor at runtime. In this way, we can react quickly when an environment variable misses or when someone changes the API contract without informing us.
A small validation layer in our applications can prevent a bad user experience and notify us immediately, so we can fix the problem as soon as possible and mitigate the visualization of wrong data.