Skip to content

fix(types): Vendor minimal type for localforage in Offline integration #3508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/integrations/src/offline.ts
Original file line number Diff line number Diff line change
@@ -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<T>(key: string, value: T, callback?: (err: any, value: T) => void): Promise<T>;
iterate<T, U>(
iteratee: (value: T, key: string, iterationNumber: number) => U,
callback?: (err: any, result: U) => void,
): Promise<U>;
removeItem(key: string, callback?: (err: any) => void): Promise<void>;
};

/**
* cache offline errors and send when connected
*/
Expand Down Expand Up @@ -36,7 +46,7 @@ export class Offline implements Integration {
/**
* event cache
*/
public offlineEventStore: typeof localForage;
public offlineEventStore: LocalForage;

/**
* @inheritDoc
Expand Down