Skip to content

TupleReturn only works on method definitions, not on function-typed variables. #578

@Perryvw

Description

@Perryvw

Consider the following TypeScript:

interface MyInterface {
    /** @tupleReturn */
    getRaw(name: string): [number, number];
    /** @tupleReturn */
    getRaw2: (name: string) => [number, number];
}
declare var inst: MyInterface;

const [a, b] = inst.getRaw("abc");
const [c, d] = inst.getRaw2("abc");

I would expect both getRaw and getRaw2 to respect the tupleReturn directive and produce the same code, but instead this produces the following code:

local a, b = inst:getRaw("abc")
local c, d = table.unpack(inst:getRaw2("abc"))

Playground link

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions