Skip to content

Commit 2327642

Browse files
authored
ref(core)!: Cleanup internal types, including ReportDialogOptions (#14861)
These are small changes, cleaning up outdated (I believe?) TODOs, and some internal type stuff.
1 parent d5af638 commit 2327642

File tree

9 files changed

+37
-48
lines changed

9 files changed

+37
-48
lines changed

docs/migration/v8-to-v9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ Since v9, the types have been merged into `@sentry/core`, which removed some of
228228
- The `IntegrationClass` type is no longer exported - it was not used anymore. Instead, use `Integration` or `IntegrationFn`.
229229
- The `samplingContext.request` attribute in the `tracesSampler` has been removed. Use `samplingContext.normalizedRequest` instead. Note that the type of `normalizedRequest` differs from `request`.
230230
- `Client` now always expects the `BaseClient` class - there is no more abstract `Client` that can be implemented! Any `Client` class has to extend from `BaseClient`.
231+
- `ReportDialogOptions` now extends `Record<string, unknown>` instead of `Record<string, any>` - this should not affect most users.
231232

232233
# No Version Support Timeline
233234

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"circularDepCheck": "lerna run circularDepCheck",
1616
"clean": "run-s clean:build clean:caches",
1717
"clean:build": "lerna run clean",
18-
"clean:caches": "yarn rimraf eslintcache .nxcache && yarn jest --clearCache",
18+
"clean:caches": "yarn rimraf eslintcache .nxcache .nx && yarn jest --clearCache",
1919
"clean:deps": "lerna clean --yes && rm -rf node_modules && yarn",
2020
"clean:tarballs": "rimraf {packages,dev-packages}/*/*.tgz",
2121
"clean:watchman": "watchman watch-del \".\"",

packages/browser-utils/src/metrics/inp.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ function _trackINP(): () => void {
127127

128128
/**
129129
* Register a listener to cache route information for INP interactions.
130-
* TODO(v9): `latestRoute` no longer needs to be passed in and will be removed in v9.
131130
*/
132-
export function registerInpInteractionListener(_latestRoute?: unknown): void {
131+
export function registerInpInteractionListener(): void {
133132
const handleEntries = ({ entries }: { entries: PerformanceEntry[] }): void => {
134133
const activeSpan = getActiveSpan();
135134
const activeRootSpan = activeSpan && getRootSpan(activeSpan);

packages/browser/src/exports.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ export type {
1313
Thread,
1414
User,
1515
Session,
16+
ReportDialogOptions,
1617
} from '@sentry/core';
1718

1819
export type { BrowserOptions } from './client';
1920

20-
export type { ReportDialogOptions } from './sdk';
21-
2221
export {
2322
addEventProcessor,
2423
addBreadcrumb,

packages/browser/src/sdk.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Client, DsnLike, Integration, Options } from '@sentry/core';
1+
import type { Client, Integration, Options, ReportDialogOptions } from '@sentry/core';
22
import {
33
consoleSandbox,
44
dedupeIntegration,
@@ -200,37 +200,6 @@ export function init(browserOptions: BrowserOptions = {}): Client | undefined {
200200
return initAndBind(BrowserClient, clientOptions);
201201
}
202202

203-
/**
204-
* All properties the report dialog supports
205-
*/
206-
export interface ReportDialogOptions {
207-
// TODO(v9): Change this to [key: string]: unknkown;
208-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
209-
[key: string]: any;
210-
eventId?: string;
211-
dsn?: DsnLike;
212-
user?: {
213-
email?: string;
214-
name?: string;
215-
};
216-
lang?: string;
217-
title?: string;
218-
subtitle?: string;
219-
subtitle2?: string;
220-
labelName?: string;
221-
labelEmail?: string;
222-
labelComments?: string;
223-
labelClose?: string;
224-
labelSubmit?: string;
225-
errorGeneric?: string;
226-
errorFormEntry?: string;
227-
successMessage?: string;
228-
/** Callback after reportDialog showed up */
229-
onLoad?(this: void): void;
230-
/** Callback after reportDialog closed */
231-
onClose?(this: void): void;
232-
}
233-
234203
/**
235204
* Present the user with a report dialog.
236205
*

packages/core/src/api.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { ReportDialogOptions } from './report-dialog';
12
import type { DsnComponents, DsnLike, SdkInfo } from './types-hoist';
23
import { dsnToString, makeDsn } from './utils-hoist/dsn';
34

@@ -44,15 +45,7 @@ export function getEnvelopeEndpointWithUrlEncodedAuth(dsn: DsnComponents, tunnel
4445
}
4546

4647
/** Returns the url to the report dialog endpoint. */
47-
export function getReportDialogEndpoint(
48-
dsnLike: DsnLike,
49-
dialogOptions: {
50-
// TODO(v9): Change this to [key: string]: unknown;
51-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
52-
[key: string]: any;
53-
user?: { name?: string; email?: string };
54-
},
55-
): string {
48+
export function getReportDialogEndpoint(dsnLike: DsnLike, dialogOptions: ReportDialogOptions): string {
5649
const dsn = makeDsn(dsnLike);
5750
if (!dsn) {
5851
return '';

packages/core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export {
111111
} from './fetch';
112112
export { trpcMiddleware } from './trpc';
113113
export { captureFeedback } from './feedback';
114+
export type { ReportDialogOptions } from './report-dialog';
114115

115116
// eslint-disable-next-line deprecation/deprecation
116117
export { getCurrentHubShim, getCurrentHub } from './getCurrentHubShim';

packages/core/src/report-dialog.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import type { DsnLike } from './types-hoist/dsn';
2+
3+
/**
4+
* All properties the report dialog supports
5+
*/
6+
export interface ReportDialogOptions extends Record<string, unknown> {
7+
eventId?: string;
8+
dsn?: DsnLike;
9+
user?: {
10+
email?: string;
11+
name?: string;
12+
};
13+
lang?: string;
14+
title?: string;
15+
subtitle?: string;
16+
subtitle2?: string;
17+
labelName?: string;
18+
labelEmail?: string;
19+
labelComments?: string;
20+
labelClose?: string;
21+
labelSubmit?: string;
22+
errorGeneric?: string;
23+
errorFormEntry?: string;
24+
successMessage?: string;
25+
/** Callback after reportDialog showed up */
26+
onLoad?(this: void): void;
27+
/** Callback after reportDialog closed */
28+
onClose?(this: void): void;
29+
}

packages/core/src/types-hoist/wrappedfunction.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*/
44
// eslint-disable-next-line @typescript-eslint/ban-types
55
export type WrappedFunction<T extends Function = Function> = T & {
6-
// TODO(v9): Remove this
7-
[key: string]: any;
86
__sentry_wrapped__?: WrappedFunction<T>;
97
__sentry_original__?: T;
108
};

0 commit comments

Comments
 (0)