T
TanStack•13mo ago
correct-apricot

Typescript type issues with validate after updating to v7.52.0

Hi, the following snippet started showing typescript type errors after I updated the react-hook-form version to v7.52.0 while it was working fine for v7.51.5. It has something to do with the following PR and I was wondering if someone can help me out to figure out whether the problem is in my code or something with the library. I had to change the rules?: RegisterOptions; to rules?: RegisterOptions<T, Path<T>>; after the version update. Link to the snippet: https://stackblitz.com/edit/vitejs-vite-lqawwb?file=src%2FForm.tsx Link to the PR: https://github.com/react-hook-form/react-hook-form/pull/11969 PS: validate works fine if there is only one property and type of string in FormInputs type
GitHub
fix: enforce type safety for deps property in RegisterOptions b...
Overview This PR restricts the deps property within RegisterOptions to accept only field names or an array of field names instead of string | string[]. This change improves type safety and prevents...
2 Replies
like-gold
like-gold•13mo ago
Maybe you wanted this for your validate function?
return typeof value === "string" && value.length > 20;
return typeof value === "string" && value.length > 20;
Also, this is the Discord for TanStack Form and not 'react-hook-form' 🙂
correct-apricot
correct-apricotOP•13mo ago
My bad 😦 I somehow mixed them both.

Did you find this page helpful?