In TypeScript, is there a way for a class to refer to its constructor in a way that works when it is subclassed?
abstract class Base<T> {
constructor(readonly value: T) {}
abstract getName(): string;
clone() {
const Cls = this.constructor;
return new Cls(this.value);
}
}
In this snippet, Cls is given the type Function and so the compiler complains that: "Cannot use 'new' with an expression whose type lacks a call or construct signature."