8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In @zod/mini, both extend and merge lose schema type information and resolve to a plain object, breaking inference.
@zod/mini
extend
merge
import * as z from "@zod/mini"; const Test = z.object({ test: z.string(), }); const Test2 = z.extend(Test, { test2: z.string(), }); type Test2 = z.infer<typeof Test2>; const test2 = {} as Test2; console.log(test2.test); console.log(test2.test2);
Errors:
Property 'test' does not exist on type 'object'. Property 'test2' does not exist on type 'object'.
Playground Link
Using .intersection() works but is not compatible with ZodMiniObject and introduces other type issues.
.intersection()
ZodMiniObject
extend and merge should preserve the schema and allow proper type inference like in zod.
The text was updated successfully, but these errors were encountered:
looks like a duplicate of #4082
Sorry, something went wrong.
Fixed some time ago, upgrade to the latest betas. 👍
Note that you'll need to rewrite your v4 imports to "zod/v4" after upgrading; for more information, see #4364
"zod/v4"
No branches or pull requests
In
@zod/mini
, bothextend
andmerge
lose schema type information and resolve to a plain object, breaking inference.Errors:
Playground Link
Workaround
Using
.intersection()
works but is not compatible withZodMiniObject
and introduces other type issues.Expected
extend
andmerge
should preserve the schema and allow proper type inference like in zod.The text was updated successfully, but these errors were encountered: