resolvers
resolvers copied to clipboard
Typeerror when used with zod 3.23
Describe the bug
When used together with zod 3.23 it will throw type errors in the zodResolver()
function, all schemas does this
To Reproduce Use latest release of @hookform/resolvers with zod 3.23
Expected behavior To work with zod 3.23
After updating to zod 3.23.8
this issue started appearing for me.
Updating @hookform/resolvers
to 3.3.4
does not help.
TypeScript error message:
Argument of type 'ZodObject<{ email: ZodString; }, "strip", ZodTypeAny, { email: string; }, { email: string; }>' is not assignable to parameter of type 'ZodType<any, any, any>'.
The types of '_getOrReturnCtx(...).common.issues' are incompatible between these types.
Type 'Zod.ZodIssue[]' is not assignable to type 'import("/web/node_modules/.pnpm/[email protected]/node_modules/zod/lib/ZodError").ZodIssue[]'.
Type 'Zod.ZodIssue' is not assignable to type 'import("/web/node_modules/.pnpm/[email protected]/node_modules/zod/lib/ZodError").ZodIssue'.
Type 'ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'ZodIssue'.
Type 'Zod.ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'import("/web/node_modules/.pnpm/[email protected]/node_modules/zod/lib/ZodError").ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }'.
Type 'ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'ZodInvalidUnionIssue'.
Types of property 'unionErrors' are incompatible.
Type 'Zod.ZodError<any>[]' is not assignable to type 'import("/web/node_modules/.pnpm/[email protected]/node_modules/zod/lib/ZodError").ZodError<any>[]'.
Type 'Zod.ZodError<any>' is not assignable to type 'import("/web/node_modules/.pnpm/[email protected]/node_modules/zod/lib/ZodError").ZodError<any>'.
Types of property 'issues' are incompatible.
Type 'Zod.ZodIssue[]' is not assignable to type 'import("/web/node_modules/.pnpm/[email protected]/node_modules/zod/lib/ZodError").ZodIssue[]'.
Type 'Zod.ZodIssue' is not assignable to type 'import("/web/node_modules/.pnpm/[email protected]/node_modules/zod/lib/ZodError").ZodIssue'.
Type 'ZodInvalidArgumentsIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'ZodIssue'.
This issue goes away when downgrading @hookform/resolvers to ^2.0.0
Can you please provide a minimal reproducible example (e.g. a Codesandbox)?