Here is how my type definition looks:
export type AuthType = boolean | { roles: string[]; assistant?: string[] } | (() => void);
Now, I need to check the type of the auth
variable and assign a value or execute a function in this line of code:
req.allowed = auth === true ? this.allowed : auth.roles ? auth : auth();
Although the code functions correctly (executed only when auth is not false or null), my IDE (WebStorm) displays an error message: