То есть не дублируй руками union-типы вроде:
type Role = "system_admin" | "content_editor" | "guest_viewer";
Лучше задай объект один раз, а тип получи из него:
type ValueOf<T extends Record<PropertyKey, unknown>> = T[keyof T];
const USER_ROLE = {
Admin: "system_admin",
Editor: "content_editor",
Viewer: "guest_viewer",
} as const satisfies Record<string, string>;
type Role = ValueOf<typeof USER_ROLE>;
Теперь
Role автоматически равен:"system_admin" | "content_editor" | "guest_viewer"
Если потом добавишь новую роль в
USER_ROLE, тип обновится сам.@WebDev_Plus