Skip to content

Commit

Permalink
Fix preloadResponse type (#2975)
Browse files Browse the repository at this point in the history
* Fix a TS type

* Linting
  • Loading branch information
jeffposnick committed Nov 10, 2021
1 parent bbaac60 commit 7b09c60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/workbox-strategies/src/StrategyHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ class StrategyHandler {
event instanceof FetchEvent &&
event.preloadResponse
) {
const possiblePreloadResponse = await event.preloadResponse;
const possiblePreloadResponse = (await event.preloadResponse) as
| Response
| undefined;
if (possiblePreloadResponse) {
if (process.env.NODE_ENV !== 'production') {
logger.log(
Expand Down
3 changes: 2 additions & 1 deletion packages/workbox-strategies/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import './_version.js';
// See https://github.com/GoogleChrome/workbox/issues/2946
declare global {
interface FetchEvent {
readonly preloadResponse: Promise<Response | undefined>;
// See https://github.com/GoogleChrome/workbox/issues/2974
readonly preloadResponse: Promise<any>;
}
}

Expand Down

0 comments on commit 7b09c60

Please sign in to comment.