Skip to content

Functions with tuple return types shouldn't be compatible with regular tuples #579

@ark120202

Description

@ark120202
interface A {
    /** @tupleReturn */
    foo(): number[];
}

class B {
    foo() {
        return [1, 2];
    }
}

const a: A = new B();
// type of `result` is `number`, but value is `{ 1, 2 }`
const [result] = a.foo();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions