You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
abstractclassModel<P>{staticcreate(props: P): this {letmodel=window.store[this.name+props.id];if(model){returnmodel;}returnwindow.store[this.name+props.id]=newthis(props)}protectedconstructor(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.
The text was updated successfully, but these errors were encountered:
Also since the original reason to allow visibility on constructors was to support static factory methods. So at least this typing on static methods needs to be supported to conform to the original reason.
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.
The
Model
class is a base class. Athis
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.The text was updated successfully, but these errors were encountered: