From 97571eeb8573edf56ea61f0a17ca49a71a80ef31 Mon Sep 17 00:00:00 2001 From: Sebastian Barry Date: Tue, 7 Nov 2023 13:28:26 -0700 Subject: [PATCH] Added typing for User object in getReminderPrefs notifScheduler.ts - Added a User interface that acts as a structure instead of using any for the type --- www/js/splash/notifScheduler.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/www/js/splash/notifScheduler.ts b/www/js/splash/notifScheduler.ts index e41430529..906d0712b 100644 --- a/www/js/splash/notifScheduler.ts +++ b/www/js/splash/notifScheduler.ts @@ -226,8 +226,15 @@ const initReminderPrefs = (reminderSchemes) => { // reminder_time_of_day: string; // } -export const getReminderPrefs = async (reminderSchemes): Promise => { - const user = (await getUser()) as any; +interface User { + reminder_assignment: string; + reminder_join_date: string; + reminder_time_of_day: string; +} + +export const getReminderPrefs = async (reminderSchemes): Promise => { + const userPromise = getUser(); + const user = (await userPromise) as User; if (user?.reminder_assignment && user?.reminder_join_date && user?.reminder_time_of_day) { console.log('User already has reminder prefs, returning them', user); return user;