Closed
Description
Since constructor visibility #2341 got merged. I haven't been able to utilise it fully because the classes I can benefit from requires type parameters and this typings on static methods.
abstract class Model<P> {
static create(props: P): this {
let model = window.store[this.name + props.id];
if (model) {
return model;
}
return window.store[this.name + props.id] = new this(props)
}
protected constructor(props: P) {
}
}
The Model
class is a base class. A this
typing would be very good to refer to the subclass instead of the base class. Since many classes has type arguments in their constructors, it makes sense to allow type arguments in static factory methods as well, otherwise you cannot create type safe factory methods.