Is there any way to call super.super.methodName in TypeScript. I want to avoid calling super.methodName, but I want to call the 2nd ancestor's methodName method.
Thanks.
Is there any way to call super.super.methodName in TypeScript. I want to avoid calling super.methodName, but I want to call the 2nd ancestor's methodName method.
Thanks.
Not supported by TypeScript. You can however exploit the fact that member functions are on prototype and you can call anything with this so SomeBaseClass.prototype.methodName.call(this,/*other args*/)
Example:
class Foo{
a(){alert('foo')}
}
class Bar extends Foo{
a(){alert('bar')}
}
class Bas extends Bar{
a(){Foo.prototype.a.call(this);}
}
var bas = new Bas();
bas.a(); // Invokes Foo.a indirectly