Skip to content

Commit

Permalink
fix(browser): Adjust BrowserTransportOptions to support offline tra…
Browse files Browse the repository at this point in the history
…nsport 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`.
  • Loading branch information
Lms24 authored Apr 6, 2023
1 parent 1ab3477 commit 4395d74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/browser/src/transports/offline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function pop(store: Store): Promise<Uint8Array | string | undefined> {
});
}

interface BrowserOfflineTransportOptions extends OfflineTransportOptions {
export interface BrowserOfflineTransportOptions extends OfflineTransportOptions {
/**
* Name of indexedDb database to store envelopes in
* Default: 'sentry-offline'
Expand Down
6 changes: 5 additions & 1 deletion packages/browser/src/transports/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { BaseTransportOptions } from '@sentry/types';

export interface BrowserTransportOptions extends BaseTransportOptions {
import type { BrowserOfflineTransportOptions } from './offline';

type BaseTransportAndOfflineTransportOptions = BaseTransportOptions & BrowserOfflineTransportOptions;

export interface BrowserTransportOptions extends BaseTransportAndOfflineTransportOptions {
/** Fetch API init parameters. Used by the FetchTransport */
fetchOptions?: RequestInit;
/** Custom headers for the transport. Used by the XHRTransport and FetchTransport */
Expand Down

0 comments on commit 4395d74

Please sign in to comment.