From 4e19a15d2d617473af9475317bd95f82bd37de95 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Mon, 30 Dec 2024 19:44:50 +0100 Subject: [PATCH] chore: rely on ts infer for observer callbacks --- src/libs/Performance.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libs/Performance.tsx b/src/libs/Performance.tsx index 325e0a73d514..90233ef2652e 100644 --- a/src/libs/Performance.tsx +++ b/src/libs/Performance.tsx @@ -5,7 +5,6 @@ import React, {forwardRef, Profiler} from 'react'; import {Alert, InteractionManager} from 'react-native'; import performance, {PerformanceObserver, setResourceLoggingEnabled} from 'react-native-performance'; import type {PerformanceEntry, PerformanceMark, PerformanceMeasure} from 'react-native-performance'; -import type {PerformanceObserverEntryList} from 'react-native-performance/lib/typescript/performance-observer'; import CONST from '@src/CONST'; import isE2ETestSession from './E2E/isE2ETestSession'; import getComponentDisplayName from './getComponentDisplayName'; @@ -62,7 +61,7 @@ function measureTTI(endMark?: string): void { * Monitor native marks that we want to put on the timeline */ const nativeMarksObserver = new PerformanceObserver((list, _observer) => { - list.getEntries().forEach((entry: PerformanceEntry) => { + list.getEntries().forEach((entry) => { if (entry.name === 'nativeLaunchEnd') { measureFailSafe('nativeLaunch', 'nativeLaunchStart', 'nativeLaunchEnd'); } @@ -101,8 +100,8 @@ function setNativeMarksObserverEnabled(enabled = false): void { /** * Monitor for "_end" marks and capture "_start" to "_end" measures, including events recorded in the native layer before the app fully initializes. */ -const customMarksObserver = new PerformanceObserver((list: PerformanceObserverEntryList) => { - list.getEntriesByType('mark').forEach((mark: PerformanceEntry) => { +const customMarksObserver = new PerformanceObserver((list) => { + list.getEntriesByType('mark').forEach((mark) => { if (mark.name.endsWith('_end')) { const end = mark.name; const name = end.replace(/_end$/, ''); @@ -160,7 +159,7 @@ function printPerformanceMetrics(): void { } function subscribeToMeasurements(callback: (entry: PerformanceEntry) => void): () => void { - const observer = new PerformanceObserver((list: PerformanceObserverEntryList) => { + const observer = new PerformanceObserver((list) => { list.getEntriesByType('measure').forEach(callback); });