Skip to content

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

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

Open
n-buck opened this issue Apr 3, 2025 · 0 comments
Open

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

n-buck opened this issue Apr 3, 2025 · 0 comments

Comments

@n-buck
Copy link

n-buck commented Apr 3, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant