Skip to content

Commit ec35290

Browse files
authored
fix(integrations): Add localforage type (#2861)
1 parent beb727d commit ec35290

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

packages/integrations/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dependencies": {
1919
"@sentry/types": "5.22.1",
2020
"@sentry/utils": "5.22.1",
21-
"localforage": "^1.8.1",
21+
"localforage": "1.8.1",
2222
"tslib": "^1.9.3"
2323
},
2424
"devDependencies": {

packages/integrations/src/offline.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Event, EventProcessor, Hub, Integration } from '@sentry/types';
22
import { getGlobalObject, logger, uuid4 } from '@sentry/utils';
3-
import * as localForage from 'localforage';
3+
import * as localForageType from 'localforage';
44

5+
// eslint-disable-next-line @typescript-eslint/no-var-requires
6+
const localForage = require('localforage');
57
/**
68
* cache offline errors and send when connected
79
*/
@@ -34,14 +36,15 @@ export class Offline implements Integration {
3436
/**
3537
* event cache
3638
*/
37-
public offlineEventStore: LocalForage; // type imported from localforage
39+
public offlineEventStore: typeof localForageType; // type imported from localforage
3840

3941
/**
4042
* @inheritDoc
4143
*/
4244
public constructor(options: { maxStoredEvents?: number } = {}) {
4345
this.global = getGlobalObject<Window>();
4446
this.maxStoredEvents = options.maxStoredEvents || 30; // set a reasonable default
47+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4548
this.offlineEventStore = localForage.createInstance({
4649
name: 'sentry/offlineEventStore',
4750
});

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12386,10 +12386,10 @@ loader.js@^4.7.0:
1238612386
resolved "https://registry.yarnpkg.com/loader.js/-/loader.js-4.7.0.tgz#a1a52902001c83631efde9688b8ab3799325ef1f"
1238712387
integrity sha512-9M2KvGT6duzGMgkOcTkWb+PR/Q2Oe54df/tLgHGVmFpAmtqJ553xJh6N63iFYI2yjo2PeJXbS5skHi/QpJq4vA==
1238812388

12389-
localforage@^1.8.1:
12390-
version "1.9.0"
12391-
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.9.0.tgz#f3e4d32a8300b362b4634cc4e066d9d00d2f09d1"
12392-
integrity sha512-rR1oyNrKulpe+VM9cYmcFn6tsHuokyVHFaCM3+osEmxaHTbEk8oQu6eGDfS6DQLWi/N67XRmB8ECG37OES368g==
12389+
12390+
version "1.8.1"
12391+
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.8.1.tgz#f6c0a24b41ab33b10e4dc84342dd696f6f3e3433"
12392+
integrity sha512-azSSJJfc7h4bVpi0PGi+SmLQKJl2/8NErI+LhJsrORNikMZnhaQ7rv9fHj+ofwgSHrKRlsDCL/639a6nECIKuQ==
1239312393
dependencies:
1239412394
lie "3.1.1"
1239512395

0 commit comments

Comments
 (0)