-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Dependencies check up
- I have verified that I use latest version of all @mantine/* packages
What version of @mantine/* packages do you have in package.json?
8.0.1
What package has an issue?
@mantine/form
What framework do you use?
Vite
In which browsers you can reproduce the issue?
All
Describe the bug
The ´zodResolver´ found in @mantine/form
is not compatible with newly released zod v4.
The following sample throws the error:
Argument of type 'ZodObject<{ comment: ZodOptional<ZodString>; }, $strip>' is not assignable to parameter of type 'ZodSchema<Record<string, any>>'.
The types returned by 'safeParse(...)' are incompatible between these types.
Type 'ZodSafeParseResult<{ comment?: string | undefined; }>' is not assignable to type 'ZodParseSuccess | ZodParseError'.
Type 'ZodSafeParseError<{ comment?: string | undefined; }>' is not assignable to type 'ZodParseSuccess | ZodParseError'.
Type 'ZodSafeParseError<{ comment?: string | undefined; }>' is not assignable to type 'ZodParseError'.
Types of property 'error' are incompatible.
Property 'errors' is missing in type 'ZodError<{ comment?: string | undefined; }>' but required in type '{ errors: ZodError[]; }'.
import { Stack, TextInput } from "@mantine/core";
import { useForm, zodResolver } from "@mantine/form";
import { z } from "zod/v4";
const formSchema = z.object({
comment: z.string().optional()
});
export const Form = () => {
const form = useForm({
validate: zodResolver(formSchema),
initialValues: {
comment: ""
}
});
return (
<form>
<Stack>
<TextInput
{...form.getInputProps("comment")}
label="Comment"
/>
</Stack>
</form>
);
};
If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
No response
Self-service
- I would be willing to implement a fix for this issue
blahetal
Metadata
Metadata
Assignees
Labels
No labels