I recently defined a new class
@Injectable FooService {
constructor(private _bar:BarService){
}
}
Then I decided to extend it in the following way
@Injectable ExtFooService extends FooService {
constructor(private _bar:BarService){
super(_bar);
}
}
However, upon trying to compile, I encountered this error:
Error:(12, 14) TS2415:Class 'ExtFooService' incorrectly extends base class 'FooService'. Types have separate declarations of a private property '_bar'.
I'm puzzled as to why this is happening. Any insights?
I attempted removing the injections from ExtFooService, but encountered another issue at the super()
call:
Error:(21, 9) TS2554:Expected 2 arguments, but got 0.
Do I really need to make adjustments like this?
@Injectable ExtFooService extends FooService {
constructor(private _extBar:BarService){
super(_extBar);
}
}