documentation
documentation copied to clipboard
Extend documentation with section on new transformed values type `TTransformedValues` of `useForm` and `SubmitHandler`
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: https://github.com/react-hook-form/documentation/issues/1078. As suggested in that thread, it might be helpful to extend the documentation to describe how the new feature works.
Cheers