-
Notifications
You must be signed in to change notification settings - Fork 55
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
Support for Enum #30
Comments
If your enum is a string enum, this will work out-of-the-box without any |
Using a string enum works for serializing, but not deserializing. |
Isn't this a limitation of Typescript string enums? An enum would come in as a string request but cannot be reverse mapped to its member. |
If I specify that it should be mapped to my enum's |
Maybe try https://github.com/typestack/class-transformer. I prefer that solution to this one anyway, however, I haven't yet tried enums with it |
I think it's important to repeat that Typescript itself cannot reverse map an enum based on a string. One workaround my colleague @imperialyoyo implemented was through a converter:
|
Is there a way to support enum?
https://www.typescriptlang.org/docs/handbook/enums.html
The text was updated successfully, but these errors were encountered: