Skip to content

Can not interfere enum names when starting with a number #657

Open
@n-buck

Description

@n-buck

JSON enums allow enum-values to start with numbers.
Interfering the keys from the enum-values will result in an enum like i.e.

enum foo {
   0bar: "0bar",
   1baz: "1baz",
}

which is invalid in typescript.

I think the best way to handle this is to escape the keys, similar to special-characters:

enum foo {
   "0bar": "0bar",
   "1baz": "1baz",
}

I opened a PR for this Issue:
#656

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions