Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested spread in destructuring is not handled correctly #2587

Closed
mhegazy opened this issue Apr 1, 2015 · 0 comments
Closed

Nested spread in destructuring is not handled correctly #2587

mhegazy opened this issue Apr 1, 2015 · 0 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@mhegazy
Copy link
Contributor

mhegazy commented Apr 1, 2015

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";
@danquirk danquirk added the Bug A bug in TypeScript label Apr 1, 2015
@mhegazy mhegazy added this to the TypeScript 1.5 milestone Apr 2, 2015
@ahejlsberg ahejlsberg changed the title Nested spread in destructuring is not handled correctelly Nested spread in destructuring is not handled correctly Apr 3, 2015
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Apr 16, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants