I've been stuck on this problem for days and feel like I've exhausted my TypeScript skills. Any help would be greatly appreciated.
Although I have complex types, I'll try to simplify them for clarity.
Imagine I have two classes, Score and Metric, each with two derived classes that need to implement different methods. The scores can inherit from a base class, but the Metrics must inherit from external classes that I don't own.
I tried using Mixins to define common methods in a class factory and apply constructors based on the implementations, but I'm struggling to get it to work.
So far, I've used interfaces A and B to distinguish between functionalities or as generic kinds extending A or B where shared functions exist.
Now, however, I need to use distinct constructors based on implementation rather than just types. While I don't require access to additional methods of derived classes, I must create objects at runtime inheriting the correct method from either A or B. It seems there might not be a solution for this, prompting me to consider alternative inheritance patterns beyond A and B.
If someone could verify if there's a workaround or offer a better abstraction pattern, I'd be extremely grateful.