typescript assert enum
enum Animal { Cat = "cat", Dog = "dog", } const isAnimal(value: string): value is Animal { return Object.values<string>(Animal).includes(value); } if (isAnimal(someInputValue)) { // TODO }