Consider this class (it is supposed to be immutable):
class A {
normalMethod1(): A{
const instance = A.staticMethod1();
return instance;
}
static staticMethod1: A(){
return new this();
}
}
it works fine, but how can I replace A.staticMethod
with the current class name? Something like this.staticMethod
(which doesn't work because i get ts2576 error)
And also same thing for the return types, how to replace them with current class?
The reason for this is that if I ever change the class name, I would have to do it in one place instead of everywhere