I am creating a function that takes some roles in an Enum, I want the parameters not to be repeated.
type Role = 'ADMIN' | 'GUEST'
function roleMiddleware(...roles: Role[]){
// some logic
}
roleMiddleware('ADMIN', 'ADMIN'); // I shouldn't be able to do that
Is this achievable ? and if so how should I type the parameters of that function to achieve such behavior?