-
-
Notifications
You must be signed in to change notification settings - Fork 197
Open
Description
Version Number
5.2.1
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/fancy-architecture-xkm2g4
Steps to reproduce
- Go to the codesandbox demo
- Update the dependencies if needed
- Hover over the typescript error for the resolver
- You'll see the error:
Type '{ query?: string | undefined; }' is not assignable to type '{ query: string | undefined; }'
Expected behaviour
Since this is inferring the type from the exact schema I declare with the yup object, I'd assume it would not have any mismatch or asigning errors, but as you can see from the demo:
Type '{ query?: string | undefined; }' is not assignable to type '{ query: string | undefined;
Using .notRequired() creates the same problem.
My requirements do need this value to specifically be able to be undefined
, but the only way you can achieve that is to omit the key entirely, but I still need some sort of validation if it's there and defined.
P.S if this is more of a yup related problem then I can repost it on their github
What browsers are you seeing the problem on?
Chrome
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
davitrbv, dkhurshudian, jimmy19447 and rickdunkin
Metadata
Metadata
Assignees
Labels
No labels