Colin McDonnell
Colin McDonnell
Yeah this isn't really possible to solve with the current internals structure. The current structure is incredibly elegant and avoids a lot of complexity/fragility/limitatations that were present in Zod 3....
A new `when` param has been implemented in #4838 to users have total control over when refinements run. ```ts const schema = z .object({ password: z.string().min(8), confirmPassword: z.string(), anotherField: z.string(),...
This is a bug in your test: you're inferring the type from `recordWithBrandedStringKeys` instead of `recordWithBrandedNumberKeys`.  The inferred key type is still just `number`, and does indeed drop the...
My preference for this would be a single `.assertType(input: Input)` method that returns `void`...basically just there as a utility for type checking. I'm trying to get rid of methods not...
Here's a dedicated guide for library authors that answers some common questions: https://v4.zod.dev/library-authors 1. Best practices around peer dependencies 2. How to support Zod v3 and Zod v4 simultaneously 3....
In Zod 4 all utils are consolidated in the `z.core.util` namespace
You need `"strictNullChecks": true` in your tsconfig.json. https://github.com/colinhacks/zod/issues/43
Smart fix with `.clone()`. This is an interesting limitation of TS inference. I've found a workaround so `.clone()` shouldn't be necessary in latest betas.
Landed in 3.24.4