Skip to content

Commit

Permalink
Use typeguard
Browse files Browse the repository at this point in the history
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
  • Loading branch information
programmiri committed Aug 9, 2023
1 parent 1e70874 commit ed1ee8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion coral/src/domain/auth-user/auth-user-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const getAuthUserMockForLogin = (
// that users would change that string, so we can use it to identify
// the superadmin role, which has different view-access
const SUPERADMIN_USERROLE = "SUPERADMIN";
function isSuperAdmin(user: AuthUser) {
type SuperAdminUser = AuthUser & { userrole: typeof SUPERADMIN_USERROLE };
function isSuperAdmin(user: AuthUser): user is SuperAdminUser {
return user.userrole === SUPERADMIN_USERROLE;
}

Expand Down

0 comments on commit ed1ee8c

Please sign in to comment.