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

feature request: Enum type with key/values #30

Open
audiolion opened this issue Mar 13, 2019 · 0 comments
Open

feature request: Enum type with key/values #30

audiolion opened this issue Mar 13, 2019 · 0 comments

Comments

@audiolion
Copy link

Feature request

Ability to pass key/value pairs to Enum

Use case(s)

Creating an enum of error response codes:

Enum({ JWT_INVALID: 31003, JWT_EXPIRED: 31004 });

The current implementation of Enum just mirrors the string, but if I am trying to type some other value, like a number, I can't create a nice readable mapping e.g.

if (errorCode === Errors.JWT_INVALID) // do something
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