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
Thre is a MyKeyType to make strings type more distinctive just for typing purposes.
Code
typeMyKeyType=string&{__myKey?: true}// works okconstindexed: Record<MyKeyType,string>={}constkey: MyKeyType='myKey'// Error: Element implicitly has an 'any' type because// expression of type 'MyKeyType' can't be used to index type 'Record<MyKeyType, string>'constx=indexed[key]
Expected behavior:
Allow to use the same type for indexing as was used in Record declaration.
Actual behavior:
Error: Element implicitly has an 'any' type because
expression of type 'MyKeyType' can't be used to index type 'Record<MyKeyType, string>'
Also now indexed can not be indexed by "pure" string type.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 3.7.x-dev.201xxxxx
Thre is a
MyKeyType
to make strings type more distinctive just for typing purposes.Code
Expected behavior:
Allow to use the same type for indexing as was used in
Record
declaration.Actual behavior:
Also now
indexed
can not be indexed by "pure"string
type.The text was updated successfully, but these errors were encountered: