Post

1️⃣ .validate() — Until now, asking "is this input valid?" meant calling safeParse, which walks the whole input and builds a ZodError with an issue object for every failure .validate() returns a boolean, aborts on the first error it meets, creates no issue objects at all, and narrows the type

2️⃣ z.instanceof().properties() — If you try to validate a fetch Response with z.object(), you get back a plain object, and the prototype is gone, and so is .json(). Now you can validate properties on a class instance in place and get the same instance back with its methods intact.

3️⃣ z.withParser() — z.compile() builds its fast parser with new Function, which a strict Content Security Policy blocks So the fastest path in Zod was off limits in the apps that care most about security. withParser() lets you generate the parser at build time and plug it in under the same contract.

No replies yet.