-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
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
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue