Hi! For some reason I can't verify if a string "in" an enum / corresponding to an enum value.
I have the following enum:
export enum Command {
RUN = "run"
}
And the following code checking the string:
import { Command } from "./command.enum.ts"
const str = "run"
console.log(str in Command) // returns false
console.log(str.toUpperCase() in Command) // returns false
console.log((<any>Object).values(Command).includes(str)) // returns false
console.log((<any>Object).values(Command).includes(str.toUpperCase()) // returns false
console.log((<any>Object).keys(Command).includes(str)) // returns false
console.log((<any>Object).keys(Command).includes(str.toUpperCase()) // returns false
How do i check if a string is in an enum properly?