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

[Suggestion] Allow use of const enum values in computed properties in type literals and interfaces #13550

Closed
PyroVortex opened this issue Jan 18, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@PyroVortex
Copy link

Considering how const enum operates at compile-time, it seems odd that the following is not valid:

const enum Ids {
    alpha = 1
}

interface Foo {
    [Ids.alpha]: string
}

when it should be precisely equivalent to:

interface Foo {
    [1]: string
}

which compiles just fine.

Proposal

Allow const enum values to be used in computed property specifiers in interface declarations and type literals, just as well-known symbols are today.

@RyanCavanaugh
Copy link
Member

#10770 / #5579

@PyroVortex
Copy link
Author

Ah, I missed #10770 because I was filtering on currently open issues, and then #5579 didn't reference const enums in the description.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jan 20, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants