Description
Hey! React Native installs a performance global on every app, but its TypeScript types do not declare it.
- Libraries/Core/setUpPerformance.js installs the global. It uses setUpPerformanceModern() when NativePerformance exists, and a fallback with only performance.now() otherwise.
- src/private/webapis/performance/Performance.js is the implementation: now, timeOrigin, mark, measure, clearMarks, clearMeasures, getEntries, getEntriesByType, getEntriesByName, memory, eventCounts, rnStartupTiming.
- src/types/globals.d.ts declares neither performance nor Performance. No other .d.ts in the package does.
This is the same gap as #56325 (TextEncoder / TextDecoder).
Happy to submit a PR if that helps
Steps to reproduce
tsconfig.json
{ "compilerOptions": { "lib": ["es2022"], "types": ["react-native"], "strict": true, "noEmit": true } }
.ts file
const start = performance.now();
const p: Performance = performance;
error
error TS2304: Cannot find name 'performance'.
error TS2304: Cannot find name 'Performance'.
React Native Version
0.85.3
Affected Platforms
Other (please specify)
Output of npx @react-native-community/cli info
this is just adding ts declarations
Stacktrace or Logs
this is just adding ts declarations
MANDATORY Reproducer
this is just adding ts declarations
Screenshots and Videos
No response
Description
Hey! React Native installs a performance global on every app, but its TypeScript types do not declare it.
This is the same gap as #56325 (TextEncoder / TextDecoder).
Happy to submit a PR if that helps
Steps to reproduce
tsconfig.json
.ts file
error
React Native Version
0.85.3
Affected Platforms
Other (please specify)
Output of
npx @react-native-community/cli infoStacktrace or Logs
MANDATORY Reproducer
this is just adding ts declarations
Screenshots and Videos
No response