我想做这个:
export abstract class Base{
constructor(){
this.activate();
}
protected abstract activate():void;
}
class MyClass extends Base{
static $inject = ['myService'];
constructor(service: myService){
super();
this.myService = myService;
}
activate():void{
this.myService.doSomething();
}
}
但我不能因为派生类方法中的“this”类型是“Base”。我怎样才能使我的代码工作?
请帮忙。谢谢