type class
Specifying a class as a member type or parameter type as a class rather than just using any
To specify a class as a member type or parameter type
class View extends Events {
constructor(options:any = {}) {
super();
this.options = options;
}
initialize() {
this.model = this.options && this.options["model"] || {};
this._model = new this.model;
}
options:any
model?:class
...
}
class Model { ... }
class MyModel extends Model { ... }
class MyView extends View {
constructor(options?:any) { ... }
model = MyModel
...
}
My suggestion meets these guidelines:
Are you just looking for a constructor signature (aka newable)? Try replacing class in your example with new (...args: any) => any and see if it meets your needs.
@jcalz Thanks I will try that
Most helpful comment
Are you just looking for a constructor signature (aka
newable)? Try replacingclassin your example withnew (...args: any) => anyand see if it meets your needs.