I can write a non-generic type guard to check if a given string is a member of a string enum like this:
enum MyEnum {
Thing1 = 'thing one',
Thing2 = 'thing two',
}
const isMyEnum = (token: any): token is MyEnum => {
return Object.values(MyEnum).includes(token as MyEnum);
};
Is it possible to make this generic, so that I could re-use the same checking logic for many different string enums?