Open kirkwaiblinger opened 1 week ago
@RyanCavanaugh Sorry to ping, but I see the label has changed to "Awaiting More Feedback" but there's no other discussion. Is there anything you need from me or is discussion waiting on something else?
Neither? For feedback like this we would be wanting to hear from more than one person encountering a particular kind of situation.
Ah, gotcha, ok. I misunderstood what the label meant. Thanks for clarifying!
🔎 Search Terms
uninitialized, local, use before assign, control flow
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.7.0-dev.20240925#code/DYUwLgBAZg9jBcEDOYBOBLAdgcwNwCh8BjGTFZcAMTggF4IAKASkQDcZ0ATOgPggG98ECOiiNYMAHSgcYABYQAPBACMTAUOHQa9AOQTdBYQF98xgvhAAPAA4xUkfqaA
💻 Code
🙁 Actual behavior
No TS Error
🙂 Expected behavior
Variable 'foo' is used before being assigned.(2454)
Additional information about the issue
(this error is correctly reported if we never assign at all, as below)
Related, https://github.com/microsoft/TypeScript/issues/60064.
Otherwise this can be solved by not considering assignments which occur unconditionally after a read.