Currently, I am attempting to map a list containing objects with the same attribute but different types:
doStuff(list: Array<FilterStatus> | Array<CaseDefinition>){
list = list.map(value => ({...value, checked: true}));
}
I am encountering a TypeScript error, which is expected due to the varying types within the list. However, I am unsure of how to resolve this issue. Any suggestions or tips would be greatly appreciated.
: Cannot invoke an expression whose type lacks a call signature. Type '((callbackfn: (value: FilterStatus, index: number, array: FilterStatus[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: CaseDefinition, index: number, array: CaseDefinition[]) => U, thisArg?: any) => U[])' has no compatible call signatures.
For reference, here is a reproducible example: