Skip to content

Commit 7b09c60

Browse files
authored
Fix preloadResponse type (#2975)
* Fix a TS type * Linting
1 parent bbaac60 commit 7b09c60

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/workbox-strategies/src/StrategyHandler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ class StrategyHandler {
155155
event instanceof FetchEvent &&
156156
event.preloadResponse
157157
) {
158-
const possiblePreloadResponse = await event.preloadResponse;
158+
const possiblePreloadResponse = (await event.preloadResponse) as
159+
| Response
160+
| undefined;
159161
if (possiblePreloadResponse) {
160162
if (process.env.NODE_ENV !== 'production') {
161163
logger.log(

packages/workbox-strategies/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import './_version.js';
1818
// See https://github.com/GoogleChrome/workbox/issues/2946
1919
declare global {
2020
interface FetchEvent {
21-
readonly preloadResponse: Promise<Response | undefined>;
21+
// See https://github.com/GoogleChrome/workbox/issues/2974
22+
readonly preloadResponse: Promise<any>;
2223
}
2324
}
2425

0 commit comments

Comments
 (0)