Skip to content

Commit 9a0757a

Browse files
authored
Fix $ZodErrorTree type: Allow undefined in error items array
As per the docs, the `items` property of an error tree may include `undefined`.
1 parent 9977fb0 commit 9a0757a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/zod/src/v4/core/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ export type $ZodErrorTree<T, U = string> = T extends util.Primitive
330330
: T extends [any, ...any[]]
331331
? { errors: U[]; items?: { [K in keyof T]?: $ZodErrorTree<T[K], U> } }
332332
: T extends any[]
333-
? { errors: U[]; items?: Array<$ZodErrorTree<T[number], U>> }
333+
? { errors: U[]; items?: Array<$ZodErrorTree<T[number], U> | undefined> }
334334
: T extends object
335335
? { errors: U[]; properties?: { [K in keyof T]?: $ZodErrorTree<T[K], U> } }
336336
: { errors: U[] };

0 commit comments

Comments
 (0)