From c897b9aa55cd8991a65ae23625fce5e4a17b9935 Mon Sep 17 00:00:00 2001 From: MangoSwirl Date: Sun, 7 Jan 2024 13:54:17 -0800 Subject: [PATCH] Add "other" role --- src/lib/util/person/role/localized.ts | 7 +++++-- src/lib/util/person/role/roles.ts | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/util/person/role/localized.ts b/src/lib/util/person/role/localized.ts index 2c1974c..6639aad 100644 --- a/src/lib/util/person/role/localized.ts +++ b/src/lib/util/person/role/localized.ts @@ -1,5 +1,8 @@ -export const localizedRole = (role: string) => +import type { Role } from "./roles"; + +export const localizedRole = (role: Role) => ({ student: 'Student', - mentor: 'Mentor' + mentor: 'Mentor', + other: 'Other', }[role] ?? role); diff --git a/src/lib/util/person/role/roles.ts b/src/lib/util/person/role/roles.ts index a835ef4..b07644f 100644 --- a/src/lib/util/person/role/roles.ts +++ b/src/lib/util/person/role/roles.ts @@ -1,3 +1,3 @@ -export const roles = ['student', 'mentor']; +export const roles = ['student', 'mentor', 'other'] as const; -export type Role = 'student' | 'mentor'; +export type Role = typeof roles[number];