I not sure am I getting this error , anyone know how to solve this?
Below is my code the error occur on extra: Yup.array().of(Yup.lazy((value)....
const claimFormValidationSchema = Yup.object().shape<ClaimApplicationForm>({
id: Yup.number().notRequired(),
claimType: Yup.mixed().required(),
claimAmount: Yup.number().required('Claim Amount is Required'),
currencyCode: Yup.string().required(),
rate: Yup.number().required('Rate is Required'),
convertedAmount: Yup.number().required('Converted Amount is Required'),
extra: Yup.array().of(
Yup.lazy((value) => {
if ('required' in value) {
if (value.required === true) {
return Yup.object().shape({
value: Yup.string().required(),
});
} else {
return Yup.object().shape({
value: Yup.string().notRequired(),
});
}
}
}),
),
});
Error:
Argument of type '(value: unknown) => ObjectSchema> | undefined' is not assignable to parameter of type '(value: unknown) => Schema'. Type 'ObjectSchema> | undefined' is not assignable to type 'Schema'. Type 'undefined' is not assignable to type 'Schema'.