-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Infer types from zod schema #429
Comments
resolver is a generic function to resolve validation schema results, unless this can be applied to all schema, we probably not going to make except or tight integration with any schema lib, however, you probably build your own custom resolver to achieve that instead. https://codesandbox.io/s/react-hook-form-customresoliver-v7-8mpqw |
@victormamede Did you figure out how to make this work with Zod? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
Zod automatically infers the typescript type from schema, so I declare my FieldValues like this:
and then:
But I feel like the useForm hook should be abre to infer the type, since the useForm's resolver uses the generic TFieldValues
Resolver<TFieldValues, TContext>
Describe the solution you'd like
The zodResolver should automatically infer TFieldValues given a zod schema
Describe alternatives you've considered
Using
useForm<z.infer<typeof schema>>
but I think this is uglyThe text was updated successfully, but these errors were encountered: