-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
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 thisRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
Bug Report
🔎 Search Terms
control flow analysis, class static blocks
🕗 Version & Regression Information
- v4.4.0-beta
- v4.4.0-dev.20210708
- This is the behavior in every version I tried, and I reviewed the proposal
- I was unable to test this on prior versions because class static blocks were added in 4.4.0
⏯ Playground Link
Playground link with relevant code
💻 Code
let foo: number;
class C {
static {
foo = 3;
}
}
console.log(foo);
🙁 Actual behavior
An error Variable 'foo' is used before being assigned.(2454)
occurs at line 10, console.log(foo)
.
🙂 Expected behavior
Code compiles without errors.
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 thisRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone