I attempted to implement this conditional statement in my React project.
if (
(role !== UserRoleEnum.Admin || role !== UserRoleEnum.Employee) &&
(project.state === ProjectState.online || project.state === ProjectState.onhold)
) { }
However, I encountered an error message:
This condition will always return 'true' since the types 'UserRoleEnum.Admin' and 'UserRoleEnum.Employee' have no overlap. TS2367
Is there a better way to structure this if statement to include all conditions at once?
I want to verify that:
- The user is neither an Admin nor an Employee
- The project state is either Online or OnHold