I am trying to destructure an array of length 2, but I get a typescript error:
[ts] Tuple type '[string]' with length '1' cannot be assigned
to tuple with length '2'.
let output = {status: false};
if(execute.permission) {
let message: [string] = execute.params;
if(message.length >= 2) {
// Destructuring follows
[output['position'], output['message']] = message;
}
}
How do I tell typescript, that the array could possiblly be of length 2?