Skip to content
New issue

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

Unions not supported in map indexes (version 1.4.1.0) #1705

Closed
jice-nospam opened this issue Jan 17, 2015 · 1 comment
Closed

Unions not supported in map indexes (version 1.4.1.0) #1705

jice-nospam opened this issue Jan 17, 2015 · 1 comment
Labels
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead

Comments

@jice-nospam
Copy link

This syntax :
var map: { [index: string|number ]: number };

results in compiler error :
An index signature parameter type must be 'string' or 'number'.

@ahejlsberg
Copy link
Member

This is by design. It is already the case that a string index signature defines a constraint for all properties in a type and allows index expressions of type string, number, or any, so you can get the effect above simply by defining:

var map: { [index: string]: number };

@ahejlsberg ahejlsberg added the By Design Deprecated - use "Working as Intended" or "Design Limitation" instead label Jan 17, 2015
@mhegazy mhegazy closed this as completed Jan 17, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead
Projects
None yet
Development

No branches or pull requests

3 participants