-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[REQ][typescript-*] String Enums #3451
Comments
@eseliger a contribution would be welcome! |
@macjohnny I just realized when I wanted to port the changes to the other typescript clients, that most of them use string enums already, but typescript-angular doesn't. What would you prefer?
this one I meant 🤦♂ |
I would prefer to go with the flag, and decide later whether to default to true and introduce a breaking change. The typescript-generators are subject to refactoring, see #802 |
This is not implemented for typescript-inversify. Out of interest: What is your use case of enums in contrast to union types? I have found that the latter are sufficient. |
Enum values can be re-used elsewhere |
An exported type can also be used anywhere, no? |
this would be nice to see...has there been any activity on this request? |
Which generator are you using, @Morriz ? |
Thanks for asking! Just upgraded |
Grrr. Too quick. The typescript that gets generated is fine, but the |
Could you please create a new issue, @Morriz ? |
not needed...the stuff shown in the debugger is not what is used I deduce. TS that generates enum NOT using strings is shown, but the JS is using strings. |
Is your feature request related to a problem? Please describe.
Since TS version 2.4 string enums are supported, which are the preferred way of defining enums that can have string values (over the legacy object-type-dualism). https://www.typescriptlang.org/docs/handbook/enums.html#string-enums
Describe the solution you'd like
I implemented it already on a branch for internal use at my company, which is using an additional property called "stringEnums" for now. No breaking change since it needs to be enabled, off by default
Describe alternatives you've considered
Other solutions that would be possible are:
Comparison of outputs
before:
with string enums enabled:
The text was updated successfully, but these errors were encountered: