Skip to content

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

Closed
@PyroVortex

Description

@PyroVortex

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions