X Tutup
Skip to content

Type alias for Iterator of MultiReturn doesn't work as expected #1591

@Gudine

Description

@Gudine

Using a type alias for a LuaIterable that iterates through LuaMultiReturn makes the compiler not recognize it as a LuaMultiReturn.

The code:

type IterableAlias = LuaIterable<LuaMultiReturn<[number, number]>>;
declare const iterable: IterableAlias;
for (const [a, b] of iterable) {}

Outputs:

for ____value in iterable do
    local a = ____value[1]
    local b = ____value[2]
end

When it should instead output:

for a, b in iterable do
end

Here's a playground link with some examples.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup