I need a little help with TypeScript. How to do extension methods inheritance?
Lets say we have a class named MyClass with only one method Method1():
class MyClass {
constructor () { }
public Method1(): void {
}
}
Now I want to make a sub class that adds a new method named Method2():
class MyClassExtension {
public Method2(): void {
}
}
When I have interfaces I can do this by declaring a new interface with the same name:
interface MyInterface {
Method1(): void;
}
interface MyInterface {
Method2(): void;
}
var x: MyInterface;
x.Method1(); // ok
x.Method2(); // ok
But I don't know how to do this for classes:/ Can any1 help me, please?
Thanks in advance!!!