Skip to content

Nested spread in destructuring is not handled correctly #2587

Closed

Description

var a = [1, 2, 3], first, last;
[first, ...[a[2], last]] = a;


first === 1 && last === 3 && (a + "") === "1,2,2"

emits:

var a = [1, 2, 3], first, last;
first = a[0], [a[2], last] = a.slice(1);

first === 1 && last === 3 && (a +  "" ) === "1,2,2";

but should emit:

var a = [1, 2, 3], first, last;
first = a[0], _c = a.slice(1), a[2] = _c[0] , last = _c[1];

first === 1 && last === 3 && (a + "") === "1,2,2";

Activity

  1. changed the title [-]Nested spread in destructuring is not handled correctelly[/-] [+]Nested spread in destructuring is not handled correctly[/+] on Apr 3, 2015
  2. added a commit that references this issue on Apr 14, 2015
    2b83dfb
  3. locked and limited conversation to collaborators on Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions