You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If possible, it would be nice to be able to define enum with string values, coping over string values from other enums (if their values can be calculated statically during compilation). Example:
List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.
✅ Viability Checklist
I DON'T know if my suggestion meets these guidelines:
This wouldn't be a breaking change in existing TypeScript/JavaScript code
This wouldn't change the runtime behavior of existing JavaScript code
This could be implemented without emitting different JS based on the types of the expressions
This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
As shown above, in the code example, this will help to avoid duplicating constant string literals everywhere (if you want to define them in multiple places, including inside an enum).
💻 Use Cases
As stated in the motivation, to group string literals that are defined as constants inside enums
Activity