Title: Down-level destructuring in `for..in` statement · Issue #3715 · microsoft/TypeScript · GitHub
Open Graph Title: Down-level destructuring in `for..in` statement · Issue #3715 · microsoft/TypeScript
X Title: Down-level destructuring in `for..in` statement · Issue #3715 · microsoft/TypeScript
Description: We report an error for the following code, : for (var {toString} in { a: 1 }) { // error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. console.log(toString); } We also emit the following incorrec...
Open Graph Description: We report an error for the following code, : for (var {toString} in { a: 1 }) { // error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. console.log(toString...
X Description: We report an error for the following code, : for (var {toString} in { a: 1 }) { // error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. console.log(...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/3715
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Down-level destructuring in `for..in` statement","articleBody":"We report an error for the following code, :\n\n``` ts\nfor (var {toString} in { a: 1 }) { // error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern.\n console.log(toString);\n}\n```\n\nWe also emit the following incorrect javascript:\n\n``` ts\nfor (var toString = (void 0).toString in { a: 1 }) {\n console.log(toString);\n}\n```\n\nWe should instead emit:\n\n``` ts\nfor (var _a in { a: 1 }) {\n var toString = _a.toString;\n console.log(toString);\n}\n```\n\nWhile it is unlikely this will be very useful, this is another of the [ES6 compatibility tests](http://kangax.github.io/compat-table/es6/#destructuring_in_for-in_loop_heads) on the kangax compatibility table that we could consider addressing as it seems a small enough change.\n","author":{"url":"https://github.com/rbuckton","@type":"Person","name":"rbuckton"},"datePublished":"2015-07-02T18:55:47Z","url":"https://github.com/microsoft/TypeScript/issues/3715"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1a5d5a41-5914-fb43-0d34-66747d62c85e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D37E:2F4BD9:853B35:B288A4:6B00DD6C |
| html-safe-nonce | 6ca3f2509647857d1a33eb3b20bb2b0e40146447812b9de5e61d5d8fed7c98b1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzdFOjJGNEJEOTo4NTNCMzU6QjI4OEE0OjZCMDBERDZDIiwidmlzaXRvcl9pZCI6IjE1MDM0NTE5MjUwNzU1MTY3ODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6506454afd30c343068936aed47c194348eb86b25b7dc6d3429d911b2319ff1a |
| hovercard-subject-tag | issue:92708268 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/3715/issue_layout |
| twitter:image | https://opengraph.githubassets.com/47d6b00bf9fcfebe660ba2d7b84ace612d951f59946d53b105d944df856ea247/microsoft/TypeScript/issues/3715 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/47d6b00bf9fcfebe660ba2d7b84ace612d951f59946d53b105d944df856ea247/microsoft/TypeScript/issues/3715 |
| og:image:alt | We report an error for the following code, : for (var {toString} in { a: 1 }) { // error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. console.log(toString... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rbuckton |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width