Closed
Description
TypeScript Version: 3.8.0-dev.20200125
Search Terms:
Code
// @target: esnext
// @useDefineForClassFields. true
class C {
bar = () => this.foo1 + this.foo2;
foo1 = '';
constructor(public foo2: string) {}
}
Expected behavior:
Accessing foo1
and foo2
should not be an error as the function is not immediately invoked and therefore the properties are initialized when accessed. This worked before #36425.
Actual behavior:
used before initialization error on this.foo1
and this.foo2