In my Typescript variable declaration, I implemented a type check to ensure that all elements in an array of tuples are of length 2 and consist of numbers:
const testArea: [number, number][] = [[0, 0], [0, 220000], [220000, 220000], [220000, 0]];
This approach successfully initializes the variable, but it still permits an empty array:
const testArea: [number, number][] = []; // No error
I attempted to modify this as follows:
const testArea: [[number, number]] = [[0, 0], [0, 220000], [220000, 220000], [220000, 0]]; // error: only allows a single tuple in the array
However, this did not work for cases where there are multiple tuples in the array (although it does prevent an empty array from being valid).
Is there a way to verify that the outer array contains tuples of type [number, number]
and also ensure that it contains at least one of these tuples?