Closed
Description
TypeScript Version: 2.3.2
CODE
interface IMember {
name?: string
}
interface IBase {
member1?: IMember
}
class Base implements IBase {
public get member1() {
return this._member1
}
public _member1: IMember
public constructor() {
console.log('parent constructor this')
console.log(this)
console.log('parent constructor _member1')
const a = this._member1;
console.log(a)
expect(a).to.not.be.undefined
}
}
class Child extends Base {
public _member1: IMember = {
name: 'grrrr'
}
}
const o = new Child()
Expected Behavior:
I initialize a member variable in the Child class during class declaration.
I expect in the parent class constructor the class variable to be initialized.
Actual behavior:
It is not.
However, it is initialized after the object is constructed.