diff options
| author | Fuwn <[email protected]> | 2026-01-23 18:10:02 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-23 18:10:02 -0800 |
| commit | 7c175b9026ecd4d27c61fc52d8fa22e4c7e467d9 (patch) | |
| tree | f84a54a9478d39d853026b3f66cd95a9bd276835 /src/lib/Notification | |
| parent | fix: Disable analytics on localhost or development environments (diff) | |
| download | due.moe-7c175b9026ecd4d27c61fc52d8fa22e4c7e467d9.tar.xz due.moe-7c175b9026ecd4d27c61fc52d8fa22e4c7e467d9.zip | |
fix(Notification): Align Options interface with Notification type
Diffstat (limited to 'src/lib/Notification')
| -rw-r--r-- | src/lib/Notification/options.ts | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/lib/Notification/options.ts b/src/lib/Notification/options.ts index 3ccb20b9..be972a7e 100644 --- a/src/lib/Notification/options.ts +++ b/src/lib/Notification/options.ts @@ -1,19 +1,24 @@ type Position = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; export interface Options { - heading: string | number; - description: string | number | undefined; + heading: string; + description?: string; position: Position; duration: number; id: string; } -export const options = (preferences: { [key: string]: number | string }): Options => { +export const options = (preferences: { + heading: string; + description?: string; + position?: string; + duration?: number; +}): Options => { return { position: (preferences.position || 'top-right') as Position, - duration: Number(preferences.duration || 3000), - heading: preferences.heading || 'Notification', - description: preferences.description || undefined, + duration: preferences.duration || 3000, + heading: preferences.heading, + description: preferences.description, id: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) }; }; |