Bug Report
🔎 Search Terms
Nullish coalescing assignment
declared but its value is never read
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about Nullish coalescing assignment
⏯ Playground Link
Playground link with relevant code
💻 Code
class A {
private x?: number;
public foo(): void {
this.x ??= setTimeout(() => {});
}
}
🙁 Actual behavior
There is an error that 'x' is declared but its value is never read which is not true because ??= reads and then writes the value.
🙂 Expected behavior
No error on x.