From 77ec553a712dc27517f7f5343c4ba0813c660807 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Tue, 4 May 2021 16:55:41 -0700 Subject: [PATCH] vendor minimal type for localforage --- packages/integrations/src/offline.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/integrations/src/offline.ts b/packages/integrations/src/offline.ts index 1f7efb5b1798..654795b018c1 100644 --- a/packages/integrations/src/offline.ts +++ b/packages/integrations/src/offline.ts @@ -1,8 +1,18 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { Event, EventProcessor, Hub, Integration } from '@sentry/types'; import { getGlobalObject, logger, normalize, uuid4 } from '@sentry/utils'; import localForage from 'localforage'; +type LocalForage = { + setItem(key: string, value: T, callback?: (err: any, value: T) => void): Promise; + iterate( + iteratee: (value: T, key: string, iterationNumber: number) => U, + callback?: (err: any, result: U) => void, + ): Promise; + removeItem(key: string, callback?: (err: any) => void): Promise; +}; + /** * cache offline errors and send when connected */ @@ -36,7 +46,7 @@ export class Offline implements Integration { /** * event cache */ - public offlineEventStore: typeof localForage; + public offlineEventStore: LocalForage; /** * @inheritDoc