I'm learning TypeScript so please accept my apologies for asking a dumb question.
The following code is taken from the official docs, but it is not working. It looks like the function is expecting a Tuple of two numbers instead of Array, but on the other hand it should demonstrate Array destructuring according to the docs...
let input = [1, 2];
function f([first, second]: [number, number]) {
console.log(first);
console.log(second);
}
f(input);
The error:
src/main.ts(6,3): error TS2345: Argument of type 'number[]' is not assignable to parameter of type '[number, number]'.
Property '0' is missing in type 'number[]'.