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

fix: correct type of error field in getFieldState return object #11831

Merged
merged 3 commits into from May 5, 2024

Conversation

cj-young
Copy link
Contributor

To fix #11814.

I changed the type of the error field inside the return object of a form's getFieldState to be more general. The current implementation doesn't account for nested errors inside objects since it uses the basic FieldError type. I changed it to an indexed access type that uses the type of the actual errors object present in the form state, which itself accounts for nested objects.

Copy link

codesandbox bot commented Apr 28, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@voinik
Copy link

voinik commented May 3, 2024

Hey there! It seems that your change fixes the issue. Hope it gets merged!

@bluebill1049 bluebill1049 merged commit 4549afd into react-hook-form:master May 5, 2024
6 of 7 checks passed
rafaelcalhau pushed a commit to rafaelcalhau/react-hook-form that referenced this pull request May 5, 2024
…ect (react-hook-form#11831)

* fix: correct type of `error` field in `getFieldState` return object

* fix: update reports
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.

issue: getFieldState(..).error type is incorrect
3 participants