Closed
Description
🔎 Search Terms
- ReferenceError: can't access lexical declaration before initialization
- undetected access uninitialized variable
- used before assignment
🕗 Version & Regression Information
Reproducible in Playground with versions > 3.3.3333 including
- 4.1.3
- 4.2.0-dev20210206
- ...
Not reproducible with 3.3.3333
This changed between versions 3.3.3333 and 3.5.1
⏯ Playground Link
Playground link with relevant code
💻 Code
const [
a,
b,
] = ((): [number, number] => {
// Undetected access to uninitialized variable
console.log(a);
return [
0,
0,
];
})();
🙁 Actual behavior
Undetected access of uninitialized variable. Crash at JavaScript runtime.
🙂 Expected behavior
Compile time error: "Variable 'a' is used before being asigned."