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
constSTR='a string literal';constSYM=Symbol('a unique symbol');constvalue={[STR]: 'foo',[SYM]: 42,};typeTypeOfStr<Textends{[STR]: any;}>=T[typeofSTR];// OKtypeTypeOfSym<Textends{[SYM]: any;}>=T[typeofSYM];// ERROR// ^^^^^^^^^^^// Type 'unique symbol' cannot be used to index type 'T'typeT1=TypeOfStr<typeofvalue>;// T1 is stringtypeT2=TypeOfSym<typeofvalue>;// T2 is number
Expected behavior:
No errors. If it works for string literal types, it seems it should also work for unique symbol types.
Actual behavior:
TS2536 error with unique symbol as shown above. But the type is still correctly inferred on the last line.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.8.0-dev.20180211
Search Terms:
Code
Expected behavior:
No errors. If it works for string literal types, it seems it should also work for unique symbol types.
Actual behavior:
TS2536 error with unique symbol as shown above. But the type is still correctly inferred on the last line.
The text was updated successfully, but these errors were encountered: