I am creating a matrix / 2d array of booleans and I want to infer a type that isn't simply "ANY" for dategrid.
let yearRange = [2000,2001,2002,2003,2004];
let monthRange = [0,1,2,3,4,5,6,7,8,9,10,11];
let dateGrid = any;
yearRange.forEach((year) => {
monthRange.forEach((month) => {
dateGrid[year][month] = true;
});
});
How does one create an interface / type for dategrid that:
Infers the structure: e.g. dateGrid[yearIndex][possibleMonthValues]:boolean And restricts the months index to only the applicable months.
dateGrid[2000][0] = true
dateGrid[2000][1] = true
dateGrid[2000][2] = true
dateGrid[2000][3] = true
dateGrid[2000][4] = true
dateGrid[2000][5] = true
dateGrid[2000][6] = true
dateGrid[2000][7] = true
dateGrid[2000][8] = true
dateGrid[2000][9] = true
dateGrid[2000][10] = true
dateGrid[2000][11] = true
dateGrid[2001][0] = true
... and so on ...