Skip to content

Destructuring the arguments variable #3252

Closed
@tylergoodman

Description

@tylergoodman

Doesn't work because the IArguments interface isn't defined as an Array type. Is there a reason behind this?

Example:

function test () {
  var [a] = arguments; // Error: Type 'IArguments' is not an array type.
}

One solution is doing this:

function (...args) {
  var [ one, two, three ] = args;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions