Say I have a schema like below:
export const schema = yup.object({
id: yup.number().label("ID").positive().integer().required(),
name: yup.string().label("name").max(255).required()
});
How can I reuse and change the name
property so it’s notRequired()
? I thought I could do this via yup.reach(schema, "name").notRequired()
, but I get TS errors in my IDE that
Property ‘notRequired’ does not exist on type ‘Reference | ISchema<string, AnyObject, any, any>’. Property ‘notRequired’ does not exist on type ‘Reference’.