I have an autocomplete that should be required if either of the two fields is true.
My problem is that when I click submit, it outputs An unhandled error was caught during validation in <Formik validationSchema /> TypeError: You cannot concat() schema's of different types: string and object
category: string().when(['new', 'exist'], {
is: false,
then: object({
id: string(),
name: string(),
})
.nullable()
.required('field is required'),
}),
new: bool().nullable(),
exist: bool().nullable(),