Skip to content

Commit 0ba2003

Browse files
committed
fix PerformanceNavigationTiming type errors
1 parent 26b0c53 commit 0ba2003

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

packages/replay/src/createPerformanceEntry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { WINDOW } from '@sentry/browser';
22
import { browserPerformanceTimeOrigin } from '@sentry/utils';
33
import { record } from 'rrweb';
44

5-
import { AllPerformanceEntry, PerformancePaintTiming } from './types';
5+
import { AllPerformanceEntry, PerformanceNavigationTiming, PerformancePaintTiming } from './types';
66
import { isIngestHost } from './util/isIngestHost';
77

88
export interface ReplayPerformanceEntry {

packages/replay/src/types.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ export interface WorkerRequest {
3535

3636
declare global {
3737
const __SENTRY_REPLAY_VERSION__: string;
38-
// @ts-ignore declare again, this _should_ be there but somehow is not available in worker context
39-
type PerformanceNavigationTiming = PerformanceEntry;
4038
}
4139

42-
// PerformancePaintTiming is only available with TS 4.4 and newer
43-
// Therefore, we're exporting it here to make it available in older versions
40+
// PerformancePaintTiming and PerformanceNavigationTiming are only available with TS 4.4 and newer
41+
// Therefore, we're exporting them here to make them available in older TS versions
4442
export type PerformancePaintTiming = PerformanceEntry;
45-
43+
export type PerformanceNavigationTiming = PerformanceEntry & {
44+
type: string;
45+
transferSize: number;
46+
domComplete: number;
47+
};
4648
/**
4749
* The response from the worker
4850
*/

packages/replay/src/util/dedupePerformanceEntries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { PerformancePaintTiming } from '../types';
1+
import type { PerformanceNavigationTiming, PerformancePaintTiming } from '../types';
22

33
const NAVIGATION_ENTRY_KEYS: Array<keyof PerformanceNavigationTiming> = [
44
'name',

packages/replay/test/fixtures/performanceEntry/navigation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { PerformanceNavigationTiming } from '../../../src/types';
2+
13
export function PerformanceEntryNavigation(obj?: Partial<PerformanceNavigationTiming>): PerformanceNavigationTiming {
24
const entry = {
35
name: 'https://sentry.io/organizations/sentry/discover/',

0 commit comments

Comments
 (0)