From 5e873f5e1fb894d72cd95d107c06cecdd3f945a4 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Sun, 5 Oct 2025 23:58:27 -0400 Subject: [PATCH] define missing Notifications properties for sw --- packages/sw/src/@types/global.d.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/sw/src/@types/global.d.ts b/packages/sw/src/@types/global.d.ts index 334fa81511..0c0e33bab7 100644 --- a/packages/sw/src/@types/global.d.ts +++ b/packages/sw/src/@types/global.d.ts @@ -12,3 +12,31 @@ declare const _VERSION_: string; declare const _ENV_: string; declare const _DEV_: boolean; declare const _PERF_PREFIX_: string; + +// Extended to account for TS missing fields: https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1725 +interface NotificationOptions { + /** + * An array of actions to display in the notification, for which the default is an empty array. + * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification#actions + */ + actions?: NotificationAction[]; + + /** + * A boolean value specifying whether the user should be notified after a new notification replaces an old one. + * The default is false, which means they won't be notified. + * If true, then tag also must be set. + * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification#renotify + */ + renotify?: boolean; +} + +interface NotificationAction { + /** A string identifying a user action to be displayed on the notification. */ + action: string; + + /** A string containing action text to be shown to the user. */ + title: string; + + /** A string containing the URL of an icon to display with the action. */ + icon?: string; +}