You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you extend a generic class and pass a type argument, the instantiated constructor of the base class fails to contextually type the argument of a super call. This works correctly for base class methods, and it works correctly for constructors if the contextual type is not based on a type argument that was passed in the extends clause.
classCextendsCBase<string>{constructor(){// Does not worksuper({method(p){p.length;}// Error});// Workssuper.foo({method(p){p.length;}});}}classCBase<T>{constructor(param: ContextualType<T>){}// Works if you change this to ContextualType<string>foo(param: ContextualType<T>){}}interfaceContextualType<T2>{method(parameter: T2): void;}