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
Actual behavior: Error: an index signature parameter must be 'string' or 'number'
However: Code
letx: {[key: string]: any};x[Symbol("abcd")]=12;
Expected behavior:
Should not work based on the error above
Actual behavior:
Works
Conclusion Symbol type should be allowed as an index signature parameter type as in practice it is accepted as a valid index key type. Even the error message when doing something like:
letx: {[key: string]: any};x[true]=1;
includes 'symbol' as a valid option:
An index expression argument must be of type 'string', 'number', 'symbol' or 'any'
The text was updated successfully, but these errors were encountered:
TypeScript Version:
1.8.7 (ES6 mode)
Code
Expected behavior:
Should work
Actual behavior:
Error: an index signature parameter must be 'string' or 'number'
However:
Code
Expected behavior:
Should not work based on the error above
Actual behavior:
Works
Conclusion
Symbol
type should be allowed as an index signature parameter type as in practice it is accepted as a valid index key type. Even the error message when doing something like:includes 'symbol' as a valid option:
The text was updated successfully, but these errors were encountered: