I want to check if option is available in my question objects' answer property.
My checkbox is as following
<Checkbox
checked={
question.answer.includes(option.toString())
? true
: false
}
// onChange={handleChange}
/>
and my types for question onbect is as following
export type Question = {
id: string;
type: string;
question: string;
sideA?: string[];
sideB?: string[];
options: string[] | boolean[];
correctAnswer: string | boolean | string[];
answer: string | boolean | null | string[];
isAnswered: boolean;
};
You define answer: string | boolean | null | string[], and as far as I know, includes doesn't exists on boolean nor null