Menu

Post image 1
Post image 2
Post image 3
Post image 4
Post image 5
Post image 6
Post image 7
Post image 8
Post image 9
1 / 9
0

I got tired of translating Zod errors. So I built friendly-zod.

DEV Community·Collins Mbathi·21 days ago
#jojua83t
Reading 0:00
15s threshold

If you've shipped a form with Zod, you've written this code at least once: const result = Schema . safeParse ( input ); if ( ! result . success ) { const errors = result . error . issues . reduce (( acc , issue ) => { acc [ issue . path . join ( " . " )] = issue . message ; return acc ; }, {} as Record < string , string > ); } Enter fullscreen mode Exit fullscreen mode And then you've stared at "Invalid string: expected email" next to a form field and thought: no real user should ever see this. That tiny translation layer — between what Zod gives you and what your UI actually needs — ends up in every project. So I packaged it. It's called friendly-zod . It's free, MIT, ~2 KB minzipped, zero runtime dependencies, and works with both Zod 3 and Zod 4. npm install friendly-zod zod Enter fullscreen mode Exit fullscreen mode Here's what it does, why it exists, and how to use it whether you're writing your first form or maintaining a design system used by twelve product teams.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More