I'm trying to use alternative class provider. The best way to describe my problem is through an example. I have this service:
export MyService {
  method() {
    // Some Code
  }
}
And I am extending it with a child service:
export MyAnotherService extends MyService {
  anotherMethod() {
    // Some Code
  }
}
Then providing it in the app module's provider like this:
{ provide: MyService, useClass: MyAnotherService }
Then I'm using the parent service like this:
constructor(
  private service: MyService
) {}
ngOnInit() {
  this.service.method();
  this.service.anotherMethod(); // <- Typescript complains about this line.
}
Everything works fine and the app is running in the browser except I'm getting a TypeScript warning:
[ts] Property 'anotherMethod' does not exist on 'MyService'.
Is it possible to make TypeScript aware of the fact that anotherMethod actually exist?
Note: Accessing anotherMethod like this.service['anotherMethod']() solves the problem but I want to make TypeScript aware of this method.