Title: "Block-scoped variable used before its declaration" not detected in some cases · Issue #7477 · microsoft/TypeScript · GitHub
Open Graph Title: "Block-scoped variable used before its declaration" not detected in some cases · Issue #7477 · microsoft/TypeScript
X Title: "Block-scoped variable used before its declaration" not detected in some cases · Issue #7477 · microsoft/TypeScript
Description: Hi, this is probably only a minor/cosmetic issue, but while trying the code in https://bugzilla.mozilla.org/show_bug.cgi?id=1069480, I found that the Typescript Compiler does not detect that a variable is used before its initialization i...
Open Graph Description: Hi, this is probably only a minor/cosmetic issue, but while trying the code in https://bugzilla.mozilla.org/show_bug.cgi?id=1069480, I found that the Typescript Compiler does not detect that a vari...
X Description: Hi, this is probably only a minor/cosmetic issue, but while trying the code in https://bugzilla.mozilla.org/show_bug.cgi?id=1069480, I found that the Typescript Compiler does not detect that a vari...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/7477
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"Block-scoped variable used before its declaration\" not detected in some cases","articleBody":"Hi, this is probably only a minor/cosmetic issue, but while trying the code in https://bugzilla.mozilla.org/show_bug.cgi?id=1069480, I found that the Typescript Compiler does not detect that a variable is used before its initialization in a for-of loop with object destructuring using a computed property name.\n\n**TypeScript Version:** \nmaster (a75a02c)\n\n**Code** ([Playground](http://www.typescriptlang.org/Playground#src=%22use%20strict%22%3B%0A%0A%2F%2F%20https%3A%2F%2Fbugzilla.mozilla.org%2Fshow_bug.cgi%3Fid%3D1069480%0A%0A%2F%2F%201%3A%0Afor%20%28let%20{[a]%3A%20a}%20of%20[{%20}]%29%20continue%3B%0A%0A%2F%2F%202%3A%0Afor%20%28let%20{[a]%3A%20a}%20%3D%20{%20}%3B%20false%3B%20%29%20continue%3B%0A%0A%2F%2F%203%3A%0Alet%20{[b]%3A%20b}%20%3D%20{%20}%3B))\n\n``` ts\n\"use strict\";\n\n// 1:\nfor (let {[a]: a} of [{ }]) continue;\n\n// 2:\nfor (let {[a]: a} = { }; false; ) continue;\n\n// 3:\nlet {[b]: b} = { };\n```\n\n**Expected behavior:**\nFor 1), 2) and 3) the error \"Block-scoped variable used before its declaration\" should be reported.\n\n**Actual behavior:** \nNo error reported for 1), correct errors reported for 2) and 3).\n\nThanks!\n","author":{"url":"https://github.com/T18970237136","@type":"Person","name":"T18970237136"},"datePublished":"2016-03-11T08:49:35Z","url":"https://github.com/microsoft/TypeScript/issues/7477"}
| 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:f79d5a6a-9971-53d0-a187-5b0f4cf4b742 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B14C:842EC:EA7875:13A1CB3:6B010AB9 |
| html-safe-nonce | 1203132eeaccf6c26bb5ad8e1f35dbbedffe3fe25412e7158c86da3e5e6fa2e3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTRDOjg0MkVDOkVBNzg3NToxM0ExQ0IzOjZCMDEwQUI5IiwidmlzaXRvcl9pZCI6IjI5NDkxMzY4NjQ2NDIxNDA4NTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7c67ff2d8c22427ec2f8eb65fb2ca923d3a49babd3b5d404f81276550e2df20b |
| hovercard-subject-tag | issue:140125026 |
| 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/7477/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4dfde005ac68541b43eeb283cf6e37643dad1922c7713f3d0de64024ad73f2d4/microsoft/TypeScript/issues/7477 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4dfde005ac68541b43eeb283cf6e37643dad1922c7713f3d0de64024ad73f2d4/microsoft/TypeScript/issues/7477 |
| og:image:alt | Hi, this is probably only a minor/cosmetic issue, but while trying the code in https://bugzilla.mozilla.org/show_bug.cgi?id=1069480, I found that the Typescript Compiler does not detect that a vari... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | T18970237136 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width