Skip to content

Commit 4a72b76

Browse files
committed
small ref to safe bundle size
1 parent b462471 commit 4a72b76

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,10 @@ function _addPerformanceNavigationTiming(
479479
timeOrigin: number,
480480
name?: string,
481481
): void {
482-
const eventEnd = getEndPropertyNameForNavigationTiming(event);
482+
const eventEnd = getEndPropertyNameForNavigationTiming(event) satisfies keyof PerformanceNavigationTiming;
483483
const end = entry[eventEnd];
484484
const start = entry[`${event}Start`];
485-
if (typeof start !== 'number' || typeof end !== 'number') {
485+
if (!start || !end) {
486486
return;
487487
}
488488
startAndEndSpan(span, timeOrigin + msToSec(start), timeOrigin + msToSec(end), {
@@ -504,7 +504,15 @@ function getEndPropertyNameForNavigationTiming(
504504
| 'connect'
505505
| 'domContentLoadedEvent'
506506
| 'loadEvent',
507-
): keyof PerformanceNavigationTiming {
507+
):
508+
| 'connectEnd'
509+
| 'domainLookupStart'
510+
| 'domainLookupEnd'
511+
| 'unloadEventEnd'
512+
| 'redirectEnd'
513+
| 'connectEnd'
514+
| 'domContentLoadedEventEnd'
515+
| 'loadEventEnd' {
508516
if (event === 'secureConnection') {
509517
return 'connectEnd';
510518
}

0 commit comments

Comments
 (0)