We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi everyone I'm using react-hook-form with yup in my project and i'm facing a little problem in a specific use case
Here's a simple schema with infered type
const schema = yup.object({ field1: yup.string(), field2: yup.string() }) interface FormInputs extends yup.InferType<typeof schema>{}
I found out that i can't use yup.object().shape(...) with InferType as it will return any (as mentioned here)
yup.object().shape(...)
any
My problem come when I need to use yup.object().shape() with noSortEdge to avoid cyclic depency, like this :
yup.object().shape()
const schema = yup.object().shape({ field1: yup.string().when("field2", { is: (val) => !!val, then: (schema) => schema.required() }), field2: yup.string().when("field1", { is: (val) => !!val, then: (schema) => schema.required() }) },[['field1','field2']]);
In this case, yup.InferType is not working as expected, but on the other hand, I need to use shape to avoid cyclic dependency
shape
Is there a way to keep InferType specificity and avoid cyclic dependency at the same time ?
Here is a sandbox
Let me know if you need more clarifications on my probem and thanks for your help (and for this library !)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi everyone
I'm using react-hook-form with yup in my project and i'm facing a little problem in a specific use case
Here's a simple schema with infered type
I found out that i can't use
yup.object().shape(...)
with InferType as it will returnany
(as mentioned here)My problem come when I need to use
yup.object().shape()
with noSortEdge to avoid cyclic depency, like this :In this case, yup.InferType is not working as expected, but on the other hand, I need to use
shape
to avoid cyclic dependencyIs there a way to keep InferType specificity and avoid cyclic dependency at the same time ?
Here is a sandbox
Let me know if you need more clarifications on my probem and thanks for your help (and for this library !)
The text was updated successfully, but these errors were encountered: