From c3042f83c5593c83ea33f6c7fec0ead69bdb49be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Est=C3=A1cio=20Pereira?= Date: Thu, 3 Oct 2019 18:28:42 -0300 Subject: [PATCH] [workbox] Fixed onSync argument type (#38695) * [workbox] Fixed onSync argument type * Remove unnecessary type check --- types/workbox-sw/index.d.ts | 2 +- types/workbox-sw/workbox-sw-tests.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/workbox-sw/index.d.ts b/types/workbox-sw/index.d.ts index 7b30758be5..6069a0e4ec 100644 --- a/types/workbox-sw/index.d.ts +++ b/types/workbox-sw/index.d.ts @@ -822,7 +822,7 @@ interface QueueOptions { * Note: if the replay fails after a sync event, make sure you throw an * error, so the browser knows to retry the sync event later. */ - onSync: (queue: Queue) => void; + onSync: (queue: { queue: Queue }) => void; /** * The amount of time (in minutes) a request may be retried. After this amount of time has diff --git a/types/workbox-sw/workbox-sw-tests.ts b/types/workbox-sw/workbox-sw-tests.ts index 99bcebe422..11716d62f8 100644 --- a/types/workbox-sw/workbox-sw-tests.ts +++ b/types/workbox-sw/workbox-sw-tests.ts @@ -8,3 +8,9 @@ WorkboxSW.routing.registerRoute("/", WorkboxSW.strategies.networkFirst()); // $E WorkboxSW.precaching.precacheAndRoute(/foo/); WorkboxSW.precaching.precacheAndRoute(["some-resource.js"], {directoryIndex: "/"}); // $ExpectType void + +new WorkboxSW.backgroundSync.Queue('queue-name', { + onSync: ({ queue }) => { + queue; // $ExpectType Queue + }, +});