resolvers icon indicating copy to clipboard operation
resolvers copied to clipboard

issue: [yup] Schemas with optional fields cause type errors

Open Yama-Tomo opened this issue 7 months ago • 8 comments

Version Number

5.0.1

Codesandbox/Expo snack

https://codesandbox.io/p/sandbox/react-hook-form-resolver-issue-2t3cqg

Steps to reproduce

  1. Open Codesandbox url
  2. See line 13 of src/App.tsx
    • The following type error occurs.

    Type 'Resolver<{ hoge: string | undefined; }, any, { hoge?: string | undefined; }>' is not assignable to type 'Resolver<{ hoge?: string | undefined; }, any, { hoge?: string | undefined; }>'. Types of parameters 'values' and 'values' are incompatible. Type '{ hoge?: string | undefined; }' is not assignable to type '{ hoge: string | undefined; }'.typescript(2322)

Expected behaviour

No type errors

What browsers are you seeing the problem on?

No response

Relevant log output


Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

Yama-Tomo avatar Apr 09 '25 04:04 Yama-Tomo