I have this enum:
enum Options {
Option1 = "xyz",
Option2 = "abc"
}
I want to use the values for type checking by creating a union type of 'xyz' | 'abc'. Here is my attempt, but I get this 'const' assertion error:
const validValues = Object.values(Options);
const validKeys = validValues as const;
~~~~~~~~~~~ A 'const' assertion can only be applied to references to
enum members, or string, number, boolean, array, or object
literals.
What is the proper way to do this?