Skip to content

Destructuring array as function parameters results in a type error #9394

@niieani

Description

@niieani

TypeScript Version: 2.0.0-dev.20160628 (the same error in all older versions)

Code

function test(a: string, b: {}, c: number) {}

test('one', {}, 3); // OK

let params = ['one', {}, 3];
test(...params); // ERROR

Expected behavior:
The destructured array should resolve to the same types for each of the parameters and should not give an error.

Actual behavior:
Error:

Supplied parameters do not match any signature of call target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    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