Closed
Description
TypeScript Version: 2.3
Code
class A {
prop = 'A';
constructor() {
this.outputProp();
}
outputProp() {
console.log(this.prop);
}
}
class B extends A {
prop = 'B';
constructor() {
super();
this.outputProp();
}
}
new B();
Expected behavior:
The output of console.log
should be the value of prop
from class B
.
I would expect that a method call from the constructor
is not evaluated before the class properties are assigned.
Actual behavior:
console.log
output is A
.
Metadata
Metadata
Assignees
Labels
No labels