I have an enum define as follows:
export enum taskTypes {
WORK = 'work',
SLEEP = 'sleep',
EXERCISE = 'exercise',
EAT = 'eat'
}
On the top of my class I define the currentTask as follows:
private currentTask: string;
However, when I use the enums in [WORK, SLEEP].includes(currentTask) I get the following error.
Argument of type 'string' is not assignable to parameter of type 'currentTask'
The weird thing is when I simply just change it to use the actual string it doesn't complain.
['work', 'sleep'].includes(currentTask) ===> this works.
So what am I missing here?