Skip to content

Spread operator function arguments (regression) #28794

Closed
@sheley1998

Description

@sheley1998

TypeScript Version: 3.2.1

Search Terms: spread, arguments

Code

function test(a: number, b: number, c: number, d: number) {
    console.log(a, b, c, d);
}

const nums = [0, 1, 2, 3];

test(...nums);

Expected behavior:
the snippet above should compile without error

Actual behavior:
Error TS2556: Expected 4 arguments, but got 0 or more

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions