One of my classes is structured like this:
interface A extends EventEmitter{
on(event: "eventA", listener: () => void): this;
}
There is another class defined as follows:
interface B extends A{
on(event: "eventB", listener: () => void): this;
}
My intention is to utilize these classes in the following manner:
const foo = new B();
foo.on("eventA", listenerForA);
foo.on("eventB", listenerForB);
Note that it is not feasible to make any changes to Class A. When attempting to implement this, I encounter an Error message:
TS2415: Class 'B' incorrectly extends 'A'
PS: The declaration of both Class A and Class B is necessary, but they have been omitted here for clarity.
Edit: It has been suggested to replicate the overloads from the parent class. However, I am curious if there is an alternative method to achieve this without duplicating the overloads?
Thank you for any assistance provided.