TypeScript - how to inherit class and override lambda method
<p>I have an inherited class, and need the parent to have a virtual method, which is overridden in the child class. This method is called from the base constructor, and needs access to instance properties, so it needs to be a lambda function, so "this" is "_this".  The problem is, overriding a lambda method does not work for me like overriding a non-lambda does. Is this possible?  If not, I'd like to understand why.</p>

<p>Also, will "this" always be the same as "_this" when the method is only called from the constructor?</p>

<pre><code>class Base {
    protected prop = null;
    constructor() {
        this.init();
        this.initLambda();
    }
    init() {
        console.log("Base init");
    }
    initLambda = () =&gt; {
        console.log("Base initLambda");
    }
}
class Derived extends Base {
    constructor() {
        super();
    }
    init() {
        console.log("Derived init");
    }
    initLambda = () =&gt; {
        //let x = this.prop;
        console.log("Derived initLambda");
    }
}
</code></pre>

<p>Output:<br>
Derived init<br>
Base initLambda</p>