class A {
method : this = () => this;
}
My goal is for this to represent the current class when used as a return type, specifically a subclass of A. Therefore, the method should only return values of the same type as the class (not limited to just the base class, A).
I believe I have achieved something similar with the following code:
class A {
method : <T extends A> () => T = () => this;
}
However, it seems redundant to duplicate A
. There must be a more efficient way to accomplish this...