Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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

Open
maurer2 wants to merge 5 commits into react-hook-form:master
base: master
Choose a base branch
Loading
from maurer2:master

Conversation

Copy link
Contributor

@maurer2 maurer2 commented Aug 18, 2024
edited
Loading

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
edited
Loading

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
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /