Skip to content

Commit 3b50b45

Browse files
committed
introduce diff browser types:
1 parent a2ac541 commit 3b50b45

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

packages/browser/src/client.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import { BaseClient, NewTransport, Scope, SDK_VERSION } from '@sentry/core';
2-
import { Event, EventHint, Options, Severity, SeverityLevel, Transport } from '@sentry/types';
2+
import { ClientOptions, Event, EventHint, Options, Severity, SeverityLevel, Transport } from '@sentry/types';
33
import { getGlobalObject, logger, stackParserFromOptions } from '@sentry/utils';
44

55
import { eventFromException, eventFromMessage } from './eventbuilder';
66
import { IS_DEBUG_BUILD } from './flags';
77
import { injectReportDialog, ReportDialogOptions } from './helpers';
88
import { Breadcrumbs } from './integrations';
99

10-
/**
11-
* Configuration options for the Sentry Browser SDK.
12-
* @see BrowserClient for more information.
13-
*/
14-
export interface BrowserOptions extends Options {
10+
export interface BaseBrowserOptions {
1511
/**
1612
* A pattern for error URLs which should exclusively be sent to Sentry.
1713
* This is the opposite of {@link Options.denyUrls}.
@@ -27,19 +23,27 @@ export interface BrowserOptions extends Options {
2723
denyUrls?: Array<string | RegExp>;
2824
}
2925

26+
export interface BrowserOptions extends Options, BaseBrowserOptions {}
27+
28+
/**
29+
* Configuration options for the Sentry Browser SDK.
30+
* @see BrowserClient for more information.
31+
*/
32+
export interface BrowserClientOptions extends ClientOptions, BaseBrowserOptions {}
33+
3034
/**
3135
* The Sentry Browser SDK Client.
3236
*
3337
* @see BrowserOptions for documentation on configuration options.
3438
* @see SentryClient for usage documentation.
3539
*/
36-
export class BrowserClient extends BaseClient<BrowserOptions> {
40+
export class BrowserClient extends BaseClient<BrowserClientOptions> {
3741
/**
3842
* Creates a new Browser SDK instance.
3943
*
4044
* @param options Configuration options for this SDK.
4145
*/
42-
public constructor(options: BrowserOptions = {}, transport: Transport, newTransport?: NewTransport) {
46+
public constructor(options: BrowserClientOptions, transport: Transport, newTransport?: NewTransport) {
4347
options._metadata = options._metadata || {};
4448
options._metadata.sdk = options._metadata.sdk || {
4549
name: 'sentry.javascript.browser',
@@ -51,7 +55,6 @@ export class BrowserClient extends BaseClient<BrowserOptions> {
5155
],
5256
version: SDK_VERSION,
5357
};
54-
5558
super(options, transport, newTransport);
5659
}
5760

packages/browser/src/transports/setup.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { Transport, TransportOptions } from '@sentry/types';
99
import { supportsFetch } from '@sentry/utils';
1010

11-
import { BrowserOptions } from '../client';
11+
import { BrowserClientOptions } from '../client';
1212
import { FetchTransport } from './fetch';
1313
import { makeNewFetchTransport } from './new-fetch';
1414
import { makeNewXHRTransport } from './new-xhr';
@@ -31,7 +31,10 @@ export interface BrowserTransportOptions extends BaseTransportOptions {
3131
* this function will return a ready to use `NewTransport`.
3232
*/
3333
// TODO(v7): Adjust return value when NewTransport is the default
34-
export function setupBrowserTransport(options: BrowserOptions): { transport: Transport; newTransport?: NewTransport } {
34+
export function setupBrowserTransport(options: BrowserClientOptions): {
35+
transport: Transport;
36+
newTransport?: NewTransport;
37+
} {
3538
if (!options.dsn) {
3639
// We return the noop transport here in case there is no Dsn.
3740
return { transport: new NoopTransport() };

0 commit comments

Comments
 (0)