Can someone please assist me with this task?
Here is the API response I received:
Week At A Glance: { objA: [{}], objB: [{}] },
records: { Employee Records: [{}], Email Records: [{}], message: "" },
history: { [{}] }
Despite my attempts, I am facing difficulties in creating a model for it. This is what I have come up with so far:
interface DesiredResponse {
[key: string] : {
objA: ObjA[],
objB: ObjB[]
},
records: Records[],
history: History[]
}
interface Records {
[key: string]: EmpRecords | EmailRecords;
message: string
}
An error has occured: The property 'records' of type 'Records[]' cannot be assigned to the string index type '{ objA: BbjA[]; objB: ObjB[] }'
The property 'message' of type 'string' does not match the string index type 'EmpRecords | EmailRecords'
I would appreciate any guidance on how to efficiently set up the typing to enable auto-suggestions when using this model.