I have some Parent class and amount of Child classes that extends parent.
I need to define Map<sting,Y> where Y can be any of Child classes.
If I try to define it as Map<string, Parent> I got transpilation error
error TS2345: Argument of type 'typeof Child' is not assignable to parameter of type 'Parent'. Property 'someParentMethod' is missing in type 'typeof Child'.
As Child automatically inherits someParentMethod from Parent I don't re declare in Child class.
What is the correct way of declare needed Map argument type, so that it accepted any Child class instances?
Mapsupposed to hold instances ofChildor constructors ofChild? Please post the code that gives the error. It looks like you are passing in a constructor where it expects an instance. - jcalzChild. Example simplified code that raises mentioned error is below. Thanks in advance. ` class a { public x; } class b extends a { } let m:Map<string, a> = new Map([['a',b]]); ` - user3687562