Colin McDonnell

Results 420 comments of Colin McDonnell

In Zod 4: ```ts const TypeOneSchema = z.object({ name: z.string(), value: z.number(), }); const TypeTwoSchema = z.object({ title: z.string(), amount: z.number(), }); const TupleSchema = z.tuple([TypeOneSchema], TypeTwoSchema).check( z.minLength(5), z.maxLength(10), );...

To be honest, I kind like this approach you suggseted: ```ts z.object({}).passthrough().catch({}).pipe(myObjSchema) ``` `.prefault()` in Zod 4 may be of interest: ```ts const schema = z .object({ accept: z.string().array().catch([]), avatar_removal:...

> the mutable global config seems potentially dangerous maybe im missing somehting but what is stopping some third party library who also depends on zod from calling `z.configure` that and...

> How are arrays handled? should all items be included, or just the bad items (+index)? If the issue originates from a `ZodArray` schema, it'll contain the whole array. If...

> imagining big arrays being annoying in error logs/traces. Keep in mind there aren't many issues that would originate from `ZodArray` itself—it basically only throws an error if you pass...

> Zod is widely adopted by many projects and companies, often chosen for legal reasons and privacy concerns. If the default behavior changes to include input data in errors, simply...

This kind of thing happens when there are multiple versions of Zod in a project. Usually it's because a third-party library has an incorrectly configured peer dependency on Zod. In...

Without knowing much about this particular issue, this "Excessively deep" issue is likely fixed in Zod 4.1.6: https://github.com/colinhacks/zod/pull/5222. If you are using Zod 3.x, you can fix this issue by...

Yikes, good catch! Fixed in most recent version: `pnpm upgrade zod@next`

Landed as `z.stringbool()` in Zod 4: https://zod.dev/v4?id=stringbool