TypeScriptToLua icon indicating copy to clipboard operation
TypeScriptToLua copied to clipboard

`for...of` loop over `LuaTupleIterable` doesn't correctly transform complex binding patterns

Open ark120202 opened this issue 6 years ago • 1 comments

Playground

declare function foo(): LuaTupleIterable<[number]>;
declare function bar(): LuaTupleIterable<[[number]]>;
// Iteration over arrays passes all of these cases
// declare function foo(): [number][];
// declare function bar(): [[number]][];

// Case 1
const array = [1, 2, 3];
for ([array.length] of foo()) {}

// Case 2
let x;
export { x }
for ([x] of foo()) {}

// Case 3
let y;
for ([[y]] of bar()) {}

ark120202 avatar Mar 16 '20 16:03 ark120202

LuaTupleIterable no longer exists

Perryvw avatar Feb 26 '23 10:02 Perryvw