From ed47bfee8d004fc81dd96b27a2e92766a6596ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aaron=20D=C3=B6tsch?= <aaron@fsmpi.rwth-aachen.de> Date: Sat, 5 Aug 2023 18:51:50 +0200 Subject: [PATCH] Increase type specitifity in notification handler --- src/lib/server/notifications/handler.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/server/notifications/handler.ts b/src/lib/server/notifications/handler.ts index 07c8337..908bae1 100644 --- a/src/lib/server/notifications/handler.ts +++ b/src/lib/server/notifications/handler.ts @@ -1,6 +1,6 @@ import { db } from "$lib/server/database"; import { ChannelType } from "./channelTypes"; -import type { HandlerReturnType, NotificationChannel, NotificationData, NotificationType, PossibleNotificationType } from "../../notifications/types"; +import type { HandlerReturnError, HandlerReturnIgnored, HandlerReturnType, NotificationChannel, NotificationData, NotificationType, PossibleNotificationType } from "../../notifications/types"; export async function sendNotification<T extends PossibleNotificationType>(user: { id: number, notificationChannels: NotificationChannel[] | undefined } | number, type: NotificationType<T>, data: NotificationData<T>): Promise<HandlerReturnType[]>{ let notificationChannels: NotificationChannel[]; @@ -23,7 +23,7 @@ export async function sendNotification<T extends PossibleNotificationType>(user: status: "error", channel, error: err - } as HandlerReturnType; + } as HandlerReturnError; }); } case ChannelType.WEBHOOK.key: { @@ -33,7 +33,7 @@ export async function sendNotification<T extends PossibleNotificationType>(user: status: "error", channel, error: err - } as HandlerReturnType; + } as HandlerReturnError; }); } default: { @@ -41,7 +41,7 @@ export async function sendNotification<T extends PossibleNotificationType>(user: return { status: "ignored", channel - } as HandlerReturnType; + } as HandlerReturnIgnored; } }; })); -- GitLab