{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/7457","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/7457/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/7457/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/7457/events","html_url":"https://github.com/Microsoft/TypeScript/issues/7457","id":139812812,"number":7457,"title":"Incorrect transpile for destructuring assignment of block-scoped loop variable in closure","user":{"login":"T18970237136","id":9880824,"avatar_url":"https://avatars.githubusercontent.com/u/9880824?v=3","gravatar_id":"","url":"https://api.github.com/users/T18970237136","html_url":"https://github.com/T18970237136","followers_url":"https://api.github.com/users/T18970237136/followers","following_url":"https://api.github.com/users/T18970237136/following{/other_user}","gists_url":"https://api.github.com/users/T18970237136/gists{/gist_id}","starred_url":"https://api.github.com/users/T18970237136/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/T18970237136/subscriptions","organizations_url":"https://api.github.com/users/T18970237136/orgs","repos_url":"https://api.github.com/users/T18970237136/repos","events_url":"https://api.github.com/users/T18970237136/events{/privacy}","received_events_url":"https://api.github.com/users/T18970237136/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-10T07:46:01Z","updated_at":"2016-03-10T07:46:01Z","closed_at":null,"body":"Hi,\r\nit seems the fix for https://github.com/Microsoft/TypeScript/issues/6877 missed destructuring assignments.\r\n\r\n**TypeScript Version:** \r\nmaster (f06423b)\r\n\r\n**Code**\r\nRunning the following code in tsc or in the [playground](http://www.typescriptlang.org/Playground#src=%28function%28%29%20{%0A%09%22use%20strict%22%3B%0A%09%0A%09for%20%28let%20i%20%3D%200%3B%20i%20%3C%204%3B%20i%2B%2B%29%20{%0A%09%09%28%28%29%20%3D%3E%20[i]%20%3D%20[i%20%2B%201]%29%28%29%3B%0A%09%09console.log%28i%29%3B%0A%09}%0A}%29%28%29%3B%0A):\r\n```ts\r\n(function() {\r\n\t\"use strict\";\r\n\t\r\n\tfor (let i = 0; i < 4; i++) {\r\n\t\t(() => [i] = [i + 1])();\r\n\t\tconsole.log(i);\r\n\t}\r\n})();\r\n```\r\nwhen targeting ES5 will be compiled to:\r\n```javascript\r\n(function () {\r\n    \"use strict\";\r\n    var _loop_1 = function(i) {\r\n        (function () { return (_a = [i + 1], i = _a[0], _a); var _a; })();\r\n        console.log(i);\r\n    };\r\n    for (var i = 0; i < 4; i++) {\r\n        _loop_1(i);\r\n    }\r\n})();\r\n```\r\n\r\n**Actual behavior** when running the compiled snipped in Firefox or Chrome:\r\n```\r\n1\r\n2\r\n3\r\n4\r\n```\r\n\r\n**Expected behavior** (running the original snipped in Firefox or Chrome):\r\n```\r\n1\r\n3\r\n```\r\n\r\n**Expected compilation result**:\r\n```javascript\r\n(function () {\r\n    \"use strict\";\r\n    var _loop_1 = function(i) {\r\n        (function () { return (_a = [i + 1], i = _a[0], _a); var _a; })();\r\n        console.log(i);\r\n        out_i_1 = i;\r\n    };\r\n    var out_i_1;\r\n    for (var i = 0; i < 4; i++) {\r\n        _loop_1(i);\r\n        i = out_i_1;\r\n    }\r\n})();\r\n```\r\n\r\nNote that the same problem exists for object desctructuring.\r\n\r\nThanks!"}}