Description
Bug Report
🔎 Search Terms
Array destructuring assignment default value 7022
🕗 Version & Regression Information
Exists in 3.3.3 - 4.8.0-beta
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about this behaviour
⏯ Playground Link
Playground link with relevant code
💻 Code
const [a, b = a + 1] = [2];
console.log(`a: ${a}, b: ${b}`);
🙁 Actual behavior
Types of a
and b
inferred as any
, or if noImplicitAny
enabled, shows error: 'a' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.(7022)
🙂 Expected behavior
Types of both a
and b
should be inferred as number
.