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
typeMT<Keysextendsstring>={[keyinKeys]: number}typekeys="x"|"y";interfaceVector{x: number,y: number};constvectorA: Vector={x: 10,y: 20};constvectorB: MT<keyofVector>=vectorA;//Correctly worksconstvectorC: MT<string>=vectorB;//Correctly worksconstvectorD: MT<keys>=vectorA;//Correctly works functionMyFunc<TDataextendsMT<keyofTData>>(data: TData){consta : TData=data;constb: MT<keyofTData>=a;//Correctly works//error!constc: MT<string>=b;//MT<keyof TData> is not assignable to MT<string>}
Expected behavior:
Variable b should be assignable to c since keyof TData its a string union Actual behavior:
Type MT<keyof TData> is not assignable to MT<string>
The text was updated successfully, but these errors were encountered:
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.3.4
Code
Expected behavior:
Variable
b
should be assignable toc
sincekeyof TData
its astring
unionActual behavior:
Type MT<keyof TData> is not assignable to MT<string>
The text was updated successfully, but these errors were encountered: