Typescript - allowEnumStringTypes: Why enums and untion-types instead of only untion-types? #7703
Unanswered
SimonSimCity
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Thanks a lot for providing the feature #6237! Just wondering ... is there another option of only having union-types instead of enums? After reading an article about union types vs enums (https://fettblog.eu/tidy-typescript-avoid-enums/) I have the impression, that enums are not really type-safe and its better to use union types instead.
The types generated by this plugin (when having
allowEnumStringTypes
enabled) look like:But what would be the difference to this?
Beta Was this translation helpful? Give feedback.
All reactions