Equivalent of super for static class inheritance with typescript
inheritance, static, typescript
Solution
TypeScript, like many programming languages (C# for example), do not have the ability to call a base classes `static` methods without a direct named call.
You'll need to use the entire class name to call the static method. Depending on the nature of the functionality, you may just want to consider making the functionality non-static.
What's interesting is that the variable used to access the base class is technically available, but the compiler throws a warning about improper use of the variable.
You could today:
static MyMethod1():void {
_super.MyMethod1();
}
Generates:
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
B.myMethod1 = function () {
_super.myMethod1();
};
return B;
})(A);
That generates valid JavaScript code that would allow access to the super class (however, it does generate the warning, and I wouldn't recommend it).
Problem
I would like to know if there is an equivalent of `super` to call a static method from a child. Because so far I was only able to call public non static methods from childs, using `super`. I guess I will have to use the entire name of the parent to call the static methods, but I'm asking anyway, found nothing useful about that so far on typescript forum...