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: 3.0
Search Terms:
map union type string | number
Code
const m: { [key: string | number]: any }; class C<K extends string | number> { private _m: { [key: K]: any }; }
Expected behavior:
It compiles.
Actual behavior:
An index signature parameter type must be 'string' or 'number'. (parameter) key: string | number
Playground Link: http://www.typescriptlang.org/play/#src=const%20m%3A%20%7B%20%5Bkey%3A%20string%20%7C%20number%5D%3A%20any%20%7D%3B%0D%0A%0D%0Aclass%20C%3CK%20extends%20string%20%7C%20number%3E%20%7B%0D%0A%20%20%20%20private%20_m%3A%20%7B%20%5Bkey%3A%20K%5D%3A%20any%20%7D%3B%0D%0A%7D
The text was updated successfully, but these errors were encountered:
Probably fixed by #26797
Sorry, something went wrong.
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
No branches or pull requests
TypeScript Version: 3.0
Search Terms:
map
union type
string | number
Code
Expected behavior:
It compiles.
Actual behavior:
An index signature parameter type must be 'string' or 'number'.
(parameter) key: string | number
Playground Link: http://www.typescriptlang.org/play/#src=const%20m%3A%20%7B%20%5Bkey%3A%20string%20%7C%20number%5D%3A%20any%20%7D%3B%0D%0A%0D%0Aclass%20C%3CK%20extends%20string%20%7C%20number%3E%20%7B%0D%0A%20%20%20%20private%20_m%3A%20%7B%20%5Bkey%3A%20K%5D%3A%20any%20%7D%3B%0D%0A%7D
The text was updated successfully, but these errors were encountered: