-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
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
[bug]: Form component with Zod resolver Types of parameters value and value are incompatible. #4514
Comments
Olaf Siebert ***@***.***> schrieb am Di., 6. Aug. 2024, 09:43:
… Describe the bug
I having the Type error on the <Form {...form} and FormField <FormField
control={form.control}. The only way to get rid of the error is by add
<Form {...form as any}.
const formSchema = z.object({
isFree: z.boolean().default(false),
});
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
isFree: Boolean(initialData.isFree),
},
});
<Form {...form}>
Current versions:
***@***.***/resolvers": "^3.9.0",
"zod": "^3.23.8",
"react-hook-form": "^7.52.2",
Affected component/components
Form
How to reproduce
No steps, the lint will flag this in IDE right away
Codesandbox/StackBlitz link
*No response*
Logs
*No response*
System Info
Webstorm
Mac
Before submitting
- I've made research efforts and searched the documentation
- I've searched for existing issues
—
Reply to this email directly, view it on GitHub
<#4514>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BIO77CJJBRA6IRZJHVGVAUTZQB5AXAVCNFSM6AAAAABMBXRJ7WVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2TAMJYGEZDSNI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@nolafs Can you please provide additional code for the Form and Formfield tag? Please refer below code:
|
Thanks for getting back to me. No, prop name passed in. I go this issue was the forms in my project:
|
I am getting a similar issue after updating my depenencies:
|
This just started happening to me today. It only happens when
|
I do have the exact same issue. Did someone find any solution/workaround ? |
+1. Hoping to find a solution/workaround here. |
This issue happened to me as well, when importing the form component from a different package and separately importing "useForm" like so:
When I changed the shadcn-component to also import -> export "useForm", the type error was gone. I assume this might be some incompatibility with differen "react-hook-form"-installations in different package.json ? |
This is caused by different versions of react. The unified version of react, react-DOM,@type/ react.@type/react-DOM in package.json can solve this problem |
Describe the bug
I having the Type error on the <Form {...form} and FormField <FormField control={form.control}. The only way to get rid of the error is by add <Form {...form as any}.
Current versions:
"@hookform/resolvers": "^3.9.0",
"zod": "^3.23.8",
"react-hook-form": "^7.52.2",
Affected component/components
Form
How to reproduce
No steps, the lint will flag this in IDE right away
Codesandbox/StackBlitz link
No response
Logs
No response
System Info
Before submitting
The text was updated successfully, but these errors were encountered: