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

[Bug]: zod resolver / error type inconsistency #6265

Closed
1 task done
mlecoq opened this issue Aug 19, 2021 · 2 comments · Fixed by #6275
Closed
1 task done

[Bug]: zod resolver / error type inconsistency #6265

mlecoq opened this issue Aug 19, 2021 · 2 comments · Fixed by #6275

Comments

@mlecoq
Copy link
Contributor

mlecoq commented Aug 19, 2021

Version Number

3.7.2

Codesandbox/Expo snack

https://codesandbox.io/s/silent-sky-u9ps1?file=/src/App.tsx

Steps to reproduce

  1. Go to https://codesandbox.io/s/silent-sky-u9ps1?file=/src/App.tsx
  2. Click on submit
  3. All message errors are well displayed (according to submitted values)
  4. In the code, there is a typescript issue : errors.monday, errors.tuesday ... have no message property whereas they are returned

Expected behaviour

each key has a message property

What browsers are you seeing the problem on?

No response

Relevant log output

Property 'message' does not exist on type 'DeepMap<{ closed?: boolean | undefined; fullDay?: boolean | undefined; morningStartAt?: string | undefined; morningEndAt?: string | undefined; afternoonStartAt?: string | undefined; afternoonEndAt?: string | undefined; }, FieldError>'.ts(23

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mlecoq mlecoq added the status: under investigation aware of this issue and pending for investigation label Aug 19, 2021
mlecoq added a commit to mlecoq/react-hook-form that referenced this issue Aug 19, 2021
@bluebill1049
Copy link
Member

thanks for the issue report and provide a PR as well. 👍

bluebill1049 pushed a commit that referenced this issue Aug 20, 2021
* fix(types): #6265 objects may have error messages

* fix(lint): lint issue on unit test
@bluebill1049 bluebill1049 removed the status: under investigation aware of this issue and pending for investigation label Aug 20, 2021
@bluebill1049
Copy link
Member

bluebill1049 commented Aug 30, 2021

hey @mlecoq I think for object value, we will have to use NestedValue, otherwise hook form couldn't differentiate if it's an object of inputs or object of value. I may need to revert the above PR. cc @kotarella1110

https://react-hook-form.com/ts#NestedValue

bluebill1049 added a commit that referenced this issue Aug 30, 2021
bluebill1049 added a commit that referenced this issue Aug 30, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants