We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Version:
1.8.10
Code
type StringEnum = "one" | "two" interface IndexedObject { [index: StringEnum]: boolean }
Expected behavior: No error
Actual behavior: error TS1023: An index signature parameter type must be 'string' or 'number'.
The text was updated successfully, but these errors were encountered:
Reproducible in latest master.
At the moment only string or number keyword can be used as index parameter type, so a simpler type alias below also fails.
string
keyword
type StringEnum = string; interface IndexedObject { [index: StringEnum]: boolean }
Edit: This is intended behaviour, see the grammar of Index Signatures
Sorry, something went wrong.
This is intended behaviour, see the grammar of Index Signatures
I think that Index Signatures could be extended without regression
Duplicate of #8336, #5683, #2491, and #7656. Some of these have good discussion. This is a popular request.
No branches or pull requests
TypeScript Version:
1.8.10
Code
Expected behavior:
No error
Actual behavior:
error TS1023: An index signature parameter type must be 'string' or 'number'.
The text was updated successfully, but these errors were encountered: