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
{{ message }}
Repository navigation
Conditional types works incorrectly when generics with constraints #24190
Error:(15, 9) TS2322: Type 'this' is not assignable to type 'Class1<Interface1>'.
Type 'Class1<T>' is not assignable to type 'Class1<Interface1>'.
Type 'Interface1' is not assignable to type 'T'.
Playground Link:
Need to enable strictFunctionTypes in Options Playground
This is the result of --strictFunctionTypes class Class1 is contravariant with respect to T, since T is used in contravarient location (i.e. keyof T). The result is that Interface1 needs to be assingbale to this, which is not true.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
mhegazy commentedon Jul 18, 2018
This is the result of
--strictFunctionTypesclassClass1is contravariant with respect toT, sinceTis used in contravarient location (i.e.keyof T). The result is thatInterface1needs to be assingbale tothis, which is not true.typescript-bot commentedon Jul 30, 2018
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.