Closed ryanelian closed 3 months ago
ZodError type expects errors prop to be an array
ZodError
errors
export declare class ZodError<T = any> extends Error { issues: ZodIssue[]; get errors(): ZodIssue[]; constructor(issues: ZodIssue[]); format(): ZodFormattedError<T>; format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>; static create: (issues: ZodIssue[]) => ZodError<any>; toString(): string; get message(): string; get isEmpty(): boolean; addIssue: (sub: ZodIssue) => void; addIssues: (subs?: ZodIssue[]) => void; flatten(): typeToFlattenedError<T>; flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>; get formErrors(): typeToFlattenedError<T, string>; }
And parseErrorSchema function expects an array:
parseErrorSchema
https://github.com/react-hook-form/resolvers/blob/f7a4fd46af51a2a732c10ed652f5abfa532f4198/zod/src/zod.ts#L8-L11
Recently, we encountered an issue where the props can be undefined for some reason. I propose this PR to add a stricter check to prevent unexpected circumstances where the error.errors object is not an array.
error.errors
Resolve #696
:tada: This issue has been resolved in version 3.7.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
ZodError
type expectserrors
prop to be an arrayAnd
parseErrorSchema
function expects an array:https://github.com/react-hook-form/resolvers/blob/f7a4fd46af51a2a732c10ed652f5abfa532f4198/zod/src/zod.ts#L8-L11
Recently, we encountered an issue where the props can be undefined for some reason. I propose this PR to add a stricter check to prevent unexpected circumstances where the
error.errors
object is not an array.Resolve #696