Bug report
zodResolver() from @hookform/resolvers/zod@5.2.2 fails TypeScript overload matching when used with zod@4.3.6.
Error
Type error: No overload matches this call.
The types of '_zod.version.minor' are incompatible between these types.
Type '3' is not assignable to type '0'.
Cause
The resolver's type overloads use Zod's branded version type (_zod.version.minor). The resolver was built against Zod 4.0.x where minor is 0, but Zod 4.3.x has minor as 3. The overload signature requires an exact literal match, so the types are incompatible.
The runtime code works correctly — it detects Zod v4 schemas and resolves them fine. Only the type-level overload matching is broken.
Reproduction
- Install
zod@4.3.6 and @hookform/resolvers@5.2.2
- Create a schema:
const schema = z.object({ name: z.string() }).pick({ name: true })
- Pass it to
zodResolver(schema)
- Run
next build on Node 24 (e.g. Vercel build environment)
The error does not always reproduce locally with Node 20 — it depends on module resolution behavior. Node 24 on Vercel triggers it reliably.
Expected behavior
zodResolver() should accept any Zod v4.x schema without requiring an exact minor version match in the type overloads.
Suggested fix
The version-branded overload types should use a range or less restrictive constraint for the minor version, so that patch/minor updates within Zod v4 don't break type compatibility.
Workaround
Wrap zodResolver with a type assertion:
const resolver = zodResolver(schema as any)
Versions
@hookform/resolvers: 5.2.2
zod: 4.3.6
react-hook-form: 7.x
typescript: 5.x
- Node: 24 (Vercel build)
Bug report
zodResolver()from@hookform/resolvers/zod@5.2.2fails TypeScript overload matching when used withzod@4.3.6.Error
Cause
The resolver's type overloads use Zod's branded version type (
_zod.version.minor). The resolver was built against Zod 4.0.x whereminoris0, but Zod 4.3.x hasminoras3. The overload signature requires an exact literal match, so the types are incompatible.The runtime code works correctly — it detects Zod v4 schemas and resolves them fine. Only the type-level overload matching is broken.
Reproduction
zod@4.3.6and@hookform/resolvers@5.2.2const schema = z.object({ name: z.string() }).pick({ name: true })zodResolver(schema)next buildon Node 24 (e.g. Vercel build environment)The error does not always reproduce locally with Node 20 — it depends on module resolution behavior. Node 24 on Vercel triggers it reliably.
Expected behavior
zodResolver()should accept any Zod v4.x schema without requiring an exact minor version match in the type overloads.Suggested fix
The version-branded overload types should use a range or less restrictive constraint for the minor version, so that patch/minor updates within Zod v4 don't break type compatibility.
Workaround
Wrap
zodResolverwith a type assertion:Versions
@hookform/resolvers: 5.2.2zod: 4.3.6react-hook-form: 7.xtypescript: 5.x