-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
Zod resolver infered types are incorect since 4.1.0 #743
Comments
I'm facing the same issue but for the valibot resolver, the cause is probably the same. |
I have similar issue |
I think react-hook-form/react-hook-form#11951 is required before this repository can be updated in a similar manner to fix this bug. Edit: I've written up how I type zod form validators here which should give context to why I think the input and output types are required in react-hook-form and in this repo. |
Got it, thanks for reporting this. I'm looking into it. |
@jorisre I'm not 100% sure but woulden't it be more correct to use
The idea here is that Not 100% sure this is the same issue but it might be? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hello everyone, as I mentioned earlier, I'm currently working on it. I kindly ask for your patience, and if you have suggestions, feel free to open a pull request instead of expressing dissatisfaction. |
Thanks heap @jorisre for helping and looking into this issue 🙏 |
Hello everyone, I ran into this issue when doing some upgrades of our ts and linter. Has anyone a set of versions for |
This comment was marked as spam.
This comment was marked as spam.
My use case is with the At type level, the |
Not sure if related, but when trying to use Valibot and transforming a string to a number, like so, const myFormSchema = v.object({
foo: v.pipe(
v.string(),
v.transform((value) => Number(value))
),
}); there's a type error on the resolver, which reads:
|
@aryzing It's related, working on a fix for all resolvers. |
Describe the bug
zodResolver now infer schema type which is great but unfortunately produces invalid typings
To Reproduce
Setup a project using zod, typescript and react-hook-form, create a simple form such as
Codesandbox link (Required)
https://codesandbox.io/p/sandbox/wispy-wildflower-fk7ymp?file=%2Fsrc%2Findex.js%3A11%2C4
Expected behavior
s
is typed asstring
but should be typed asstring | undefined
Screenshots

Desktop (please complete the following information):
Additional context
I personally used to provide
useForm
both TFieldValues and TTransformedValues typings so that everything is properly typed such asbut even this is now impossible since types are clashing:
Types of parameters 'values' and 'values' are incompatible
Thank you 🙇
The text was updated successfully, but these errors were encountered: