In my particular situation, I have a class (for example "Collection") that is aware of the type it is dealing with (such as "DBType"). The constructor of this class receives a generic function (like "Transform") which takes the subtype of DBType and returns an instance of another class based on this subtype. When a user triggers a method within the collection with certain parameters, the collection can determine which subtype of DBType will be passed to the transform function.
Everything works fine if I separately provide the subtype DBType to the transform function. However, when it comes to implementing this logic within the class, I seem to hit a roadblock. I am struggling to find a solution for this dilemma. It could possibly be a limitation of TypeScript.
I have created a basic example in the playground which showcases the issue. Your assistance would be greatly appreciated.