As a newcomer to Angular with a background in Java, I am accustomed to setting up classes as data structures for my information. However, after doing some research, I have learned that interfaces should be used instead. I am facing an issue understanding how to set up an interface with nested arrays. Each array consists of field/header pairs for creating a table, and the object will be an array of these pairs. Specifically, I need help structuring the interface for two tables with a two-row header.
interface TableHeaderDetails {
field: string;
header: string;
date?: <need guidance here>;
}
forecastCol: TableHeaderDetails[];
this.forecastCol = [
{ field: 'cumulativeExpected', header: 'Cumulative Expected' },
{ field: 'cumulativeReceived', header: 'Cumulative Received' },
{ date : [
{ field: 'forecastYearMonth', header: 'Year - Month' },
{ details: [
{ field: 'expected', header: 'Expected' },
{ field: 'received', header: 'Received' }
]}
]}
];