You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I've noticed that the mapped-type when formatting an error is not reused in the recursive type.
This causes the “sub-levels” _errors of an object to be incorrectly typed.
Here's an example:
declareconsterror: z.ZodError<{flat: number;object: {nested: number}}>;constformatted=error.format(issue=>!!issue.fatal);constok: boolean[]=formatted._errors??[];// Type 'string[]' is not assignable to type 'boolean[]'constko1: boolean[]=formatted.flat?._errors??[];// Type 'string[]' is not assignable to type 'boolean[]'constko2: boolean[]=formatted.object?.nested?._errors??[];
I solved the problem locally on my end and will probably submit a “PR” soon.
The text was updated successfully, but these errors were encountered:
HugoMendes98
changed the title
The mapped-type is not recursive in from ZodFormattedError (error.format())
The mapped-type is not recursive in ZodFormattedError (error.format())
Sep 18, 2024
Hello, I've noticed that the mapped-type when formatting an error is not reused in the recursive type.
This causes the “sub-levels”
_errors
of an object to be incorrectly typed.Here's an example:
I solved the problem locally on my end and will probably submit a “PR” soon.
The text was updated successfully, but these errors were encountered: