TypeScript Version: 3.8.0-dev.20200125
Search Terms:
Code
// @target: esnext
// @useDefineForClassFields. true
class C {
constructor(public foo: string) {}
}
class D extends C {
bar = this.foo;
}
Expected behavior:
No error. The constructor of C (and therefore the initialization of foo) is already executed when bar is initialized.
Actual behavior:
used before initialization error on this.foo
Playground Link: https://www.typescriptlang.org/play/?useDefineForClassFields=true&target=99&ts=3.8.0-dev.20200125&ssl=7&ssc=2&pln=1&pc=1#code/MYGwhgzhAEDC0G8BQ1XWAewHYQC4CcBXYXDfACgAdCAjEAS2GgDMMMAuaPferAcwCUiAL5JRSUJBgARaAFMAHrjlYAJjHjI00GmHzQAvNFwALehAB0rDAG4xQA
Related Issues: #36425 @sandersn