I like the tricks :) – Kasia
You can create types from types to make sure they remain in sync.
type Role = 'ADMIN' | 'MEMBER' | 'VISITOR'
type Unprivileged = 'MEMBER' | 'VISITOR'
// ⛔️ Need to add unprivileged roles to both
type AdminRole = 'ADMIN'
type Role = AdminRole | 'MEMBER' | 'VISITOR'
type RemoveAdmin<R extends Role> =
R extends AdminRole ? never : R
type Unprivileged = RemoveAdmin<Role>
Crafted with 💛 by Riccardo