I am running into an issue with a data Interface. My API returns me the data in a format which looks something like this
export interface IApiResponse {
Success: boolean;
Error: string;
Message: string;
RowCount: number;
Data: [];
}
this works fine as long as the Data is actually an array which is often the case. But when I get lets say the detail of a contact it is only a object in Data which is not an array. So my question is there a way to handle this or is the only way to create 2 interfaces where one is for a response where data is array the other when it is object.