Skip to content

Non-primitives as enum values #826

Answered by MichalLytek
kdaniel21 asked this question in Q&A
Discussion options

You must be logged in to vote

TypeScript support only string and number enum members, so you can't use arbitrary things as enum values.

If you cheat and use JS objects as fake enums in registerEnumType, be aware that now you're on your own and things can break, especially between updates in the future.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kdaniel21
Comment options

@MichalLytek
Comment options

Answer selected by kdaniel21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants