Here's how I validate a URL param via Zod


Here's how I validate a URL param via Zod.

I'm sharing more details on how I use Zod including validating APIs, localStorage, etc in "TypeScript: Deep Dive".

Publishing in May!

Note: I'm showing verbose patterns one can use for more control over the success vs error case.

Simple cases like a single param can be handled with a one-liner inline schema like this:

View original on X