Closed
Description
Bug Report
🔎 Search Terms
Property is used before its initialization
arrow function
body
property
initializer
constructor parameter
useDefineForClassFields
🕗 Version & Regression Information
>= 3.8.3
- Also nightly
- This changed between versions 3.7.5 and 3.8.3
⏯ Playground Link
Playground link with relevant code
💻 Code
class A {
value = 1;
}
class B {
constructor(private a: A) {}
// Shows "Property 'a' is used before its initialization"
getAValue = () => this.a.value;
// No error when there's a function body
// getAValue = () => { return this.a.value };
}
useDefineForClassFields
must be true
🙁 Actual behavior
With useDefineForClassFields: true
there's an error when the arrow function has no body
🙂 Expected behavior
There should be no error