Your assumptions about the causes of errors are incorrect, and I think this is the cause of your problem ... at least as far as I understand.
lambdaExample = () => { this.value = 'one'; }
This line, for example, defines a property, not a method on Base , and you cannot override a property. The only instance method you defined in Base is methodExample .
In Child you assign a new lambaExample variable. Your call to super.lambaExample() fails because access to them is only possible with super() ; access to properties is through this . methodExample in your Child class appears as a syntax error for me.
Note that you can still call super from Child in the rewritten lambaExample property, but only in methods. It works:
lambdaExample = () => { super.methodExample(); // Success on super.<somemethod>() this.value = 'three'; }
I know only one way to declare an instance method in a class, and if you agree with this syntax, this works the way you expected:
class Base { value: string; lambdaExample() { this.value = 'one'; } methodExample() { this.value = 'two'; } } class Child extends Base { lambdaExample() { super.lambdaExample(); this.value = 'three'; } methodExample() { super.methodExample(); this.value = 'four'; } }
source share