TypeScript class mixing interfaces causing unexpected type errors in method implementation
Quick question that's been bugging me - I'm working on a project and hit a roadblock. I'm working with TypeScript 4.4 and trying to implement a class that mixes multiple interfaces, but I'm running into type errors that I need to quite figure out... I have an interface `A` with a method `doSomething`, and another interface `B` that extends `A` and adds a new method `doSomethingElse`. My class `MyClass` is supposed to implement both interfaces, but when I try to implement the methods, I get a type behavior stating that the argument types are incompatible. Here's a simplified example of my code: ```typescript interface A { doSomething(param: string): void; } interface B extends A { doSomethingElse(param: number): void; } class MyClass implements B { doSomething(param: string): void { console.log(`Doing something with ${param}`); } // This method causes a type behavior doSomethingElse(param: string): void { console.log(`Doing something else with ${param}`); } } ``` When I try to compile, I get the behavior: ``` Argument of type 'string' is not assignable to parameter of type 'number'. ``` I initially thought the scenario was with the method signature not matching, but then I double-checked the interface definitions and they seem correct. I’ve also tried changing `doSomethingElse`'s parameter type to `number`, but I still receive the same behavior when using the method elsewhere in my code. I suspect it might be related to how TypeScript infers types in the implementation, but I need to pinpoint the question. Has anyone faced a similar scenario? How can I ensure that my class properly implements both interfaces without these type conflicts? Is there a better approach? This is my first time working with Typescript 3.10. Any advice would be much appreciated. I'm coming from a different tech stack and learning Typescript. Has anyone dealt with something similar?