Skip to content

Commit 4395d74

Browse files
authored
fix(browser): Adjust BrowserTransportOptions to support offline transport options (#7775)
Our `transportOptions` init field currently isn't typed correctly to accept `BrowserOfflineTransportOptions`, causing type errors when trying to configure the offline transport. This patch fixes this bug by making `BrowserTransportOptions` extend `BrowserOfflineTransportOptions`.
1 parent 1ab3477 commit 4395d74

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/browser/src/transports/offline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function pop(store: Store): Promise<Uint8Array | string | undefined> {
7979
});
8080
}
8181

82-
interface BrowserOfflineTransportOptions extends OfflineTransportOptions {
82+
export interface BrowserOfflineTransportOptions extends OfflineTransportOptions {
8383
/**
8484
* Name of indexedDb database to store envelopes in
8585
* Default: 'sentry-offline'

packages/browser/src/transports/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import type { BaseTransportOptions } from '@sentry/types';
22

3-
export interface BrowserTransportOptions extends BaseTransportOptions {
3+
import type { BrowserOfflineTransportOptions } from './offline';
4+
5+
type BaseTransportAndOfflineTransportOptions = BaseTransportOptions & BrowserOfflineTransportOptions;
6+
7+
export interface BrowserTransportOptions extends BaseTransportAndOfflineTransportOptions {
48
/** Fetch API init parameters. Used by the FetchTransport */
59
fetchOptions?: RequestInit;
610
/** Custom headers for the transport. Used by the XHRTransport and FetchTransport */

0 commit comments

Comments
 (0)