DEV Community

Cover image for Using Zod with TypeScript: A Guide for Frontend Developers

Using Zod with TypeScript: A Guide for Frontend Developers

Harshal Ranjhani on August 17, 2024

If you're building a frontend application, you're likely working with data. Whether you're fetching data from an API, handling form submissions, or...
Collapse
 
anmolbaranwal profile image
Anmol Baranwal

I first noticed it when I was using shadcn. Zod + react form hooks make a deadly combo :)

Collapse
 
jdgamble555 profile image
Jonathan Gamble

Zod is not tree shakable, so too big and slow, use Valibot.

Collapse
 
sheraz4194 profile image
Sheraz Manzoor

I stand with you mate.
It is okay to use zod for small projects but for large scale project valibot is best choice

Collapse
 
martinbaun profile image
Martin Baun

Zod has one of the best APIs and ecosystems, but fairly slow types and parsing compared to its competition. But also it’s good enough so if you like it just use it, why not :)

Collapse
 
mexikode profile image
MexiKode ⚙

complexity for the sake of being clever.
roll your own dont be lazy

Collapse
 
kspshnik profile image
Evgeny Karpel

And how to treat tuples here?

Collapse
 
mohamed_karim_2dddebb42bd profile image
mohamed karim

Thank for sharing

Collapse
 
jangelodev profile image
João Angelo

Hi Harshal Ranjhani,
Top, very nice and helpful !
Thanks for sharing.

Collapse
 
georgewl profile image
George WL

Why does the image look weird and ugly? Did you make it blindfolded?