Relevant pages:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
https://www.typescriptlang.org/docs/handbook/variable-declarations.html
This can be supported by creating temporary variables and then doing assignment from those variables, much like how the regular TypeScript compiler does it.
e.g. let [a, b] = [1, 2] could translate to local _a = {1, 2}; local a = _a[1]; local b = _a[2] or separate the declaration of the variables to another line if possible, to avoid having local a bunch of times.
let [a, b] = [1, 2] could also technically translate to local a, b = 1, 2, but I'm not sure trying to recognise when multiple assignment can be used would be worth it.
Supporting ...rest would probably need some helper function, since Lua doesn't have an equivalent to JavaScript's Array.prototype.slice.
Relevant pages:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
https://www.typescriptlang.org/docs/handbook/variable-declarations.html
This can be supported by creating temporary variables and then doing assignment from those variables, much like how the regular TypeScript compiler does it.
e.g.
let [a, b] = [1, 2]could translate tolocal _a = {1, 2}; local a = _a[1]; local b = _a[2]or separate the declaration of the variables to another line if possible, to avoid havinglocala bunch of times.let [a, b] = [1, 2]could also technically translate tolocal a, b = 1, 2, but I'm not sure trying to recognise when multiple assignment can be used would be worth it.Supporting
...restwould probably need some helper function, since Lua doesn't have an equivalent to JavaScript'sArray.prototype.slice.