I have a Data Structure, and I am looking to create an interface for it. This is how it looks:
const TransitReport: {
title: string;
client: string;
data: {
overdueReviews: number;
outstandingCovenantBreaches: number;
outstandingMarginingBreaches: number;
periodStartDate: string;
periodEndDate: string;
};
}[]
My attempt at creating an interface was as follows:
export interface TransitReport {
title: string;
client?: string;
data: Record<string, unknown>;
overdueReviews: number;
outstandingCovenantBreaches: number;
outstandingMarginingBreaches: number;
periodStartDate: string;
periodEndDate: string;
}
Although this worked for mock API calls, I encountered an error when writing test cases:
The type '
{ title: string;
client: string;
data: {
overdueReviews: number;
outstandingCovenantBreaches: number;
outstandingMarginingBreaches: number;
periodStartDate: string;
periodEndDate: string;
}; }'
is missing properties such as overdueReviews, outstandingCovenantBreaches, outstandingMarginingBreaches, periodStartDate, and periodEndDate that are present in the 'TransitReport' type.