How to infer schema from type with Yup?

Viewed 1460

Is it possible to infer Yup schema from a Type? I know Yup can infer a TypeScript type alias using the exported InferType but I want exactly the opposite, this is from a Type get a valid schema.

Note: I'm aiming for something like this because currently I have a very large and complex Yup schema (for formik validationSchema) which is a union of other (already defined) types (generated by graphql codegen).

0 Answers
Related