-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
String enum by default #33015
Comments
Does this match your suggestion? #16464 |
@jack-williams ah, it does. My searching failed me. We can close this ticket as a duplicate as there has already been discussion there. |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
1 similar comment
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Search Terms
enum,string,string enum
Suggestion
I find myself often writing something like this:
I believe some simple syntactic sugar around the above code would slightly boost productivity for those using TypeScript.
Use Cases
For my use cases, I write most enums in the above fashion. Aside from debugging, my most common case is generating HTML tag class names from an enum.
Take the popular classnames package from Jed Watson. The documentation shows the following example:
In TypeScript:
Examples
I have no good ideas about what the syntax for this would look like. This suggestion comes purely from my experience programming in TypeScript and not from any principles (or lack thereof) of language design.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: