Skip to content
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

Extend documentation with section on new transformed values type TTransformedValues of useForm and SubmitHandler #1082

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

maurer2
Copy link
Contributor

@maurer2 maurer2 commented Aug 18, 2024

Hello, the useForm hooks and SubmitHandler method seem to have gotten updates to work better with resolvers that transform input data and return said data with different shapes, for example z.boolean().transform((value) => (value ? "Yes" : "No")),, which transforms the field value from boolean to the union type "Yes" | "No". When adding a third type parameter to useForm, e.g. const methods = useForm<TFieldValues, undefined, TTransformedValues>(), the submit method can now be used with the correct transformed type, e.g. SubmitHandler<TTransformedValues> without getting a type error.
This was first discovered here: #1078. As suggested in that thread, it might be helpful to extend the documentation to describe how the new feature works.

Cheers

Copy link

vercel bot commented Aug 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-hook-form-website ❌ Failed (Inspect) Oct 27, 2024 1:48pm

@maurer2 maurer2 changed the title Extend documentation with section on new transformed values type feature of useForm and SubmitHandler Extend documentation with section on new transformed values type TTransformedValues of useForm and SubmitHandler Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant