-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do this
Milestone
Description
🔎 Search Terms
explicit resource management, using, await using, loop initializer, Symbol.dispose, Symbol.asyncDispose, iteration, shadows
🕗 Version & Regression Information
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about https://github.com/microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs
- I was unable to test this on prior versions because _______
⏯ Playground Link
💻 Code
class Foo {}
for (using foo of []) {
const foo = new Foo();
}
🙁 Actual behavior
The transformed output throws "redeclaration of const foo "
🙂 Expected behavior
The transformed output should not throw.
Additional information about the issue
Babel is also affected by this issue: babel/babel#17318. We plan to wrap the for body within a new block when it contains shadowed binding.
Copilot
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do this