Clean up API of PerformanceMark and PerformanceMeasure (#47241)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47241

Changelog: [internal]

The options for the internal constructor of `PerformanceMeasure` shouldn't be optional. This just cleans that up.

Reviewed By: rshest

Differential Revision: D64480048

fbshipit-source-id: d0275276b11bd329aa2e4667646c67608d562299
This commit is contained in:
Rubén Norte
2024-10-30 04:58:04 -07:00
committed by Facebook GitHub Bot
parent 0dcbebd285
commit 1108b4d97b
2 changed files with 6 additions and 6 deletions
@@ -218,7 +218,7 @@ export default class Performance {
const measure = new PerformanceMeasure(measureName, {
startTime: computedStartTime,
duration: computedDuration,
duration: computedDuration ?? 0,
detail: options?.detail,
});
@@ -25,8 +25,8 @@ export type TimeStampOrName = DOMHighResTimeStamp | string;
export type PerformanceMeasureInit = {
detail?: DetailType,
startTime?: DOMHighResTimeStamp,
duration?: DOMHighResTimeStamp,
startTime: DOMHighResTimeStamp,
duration: DOMHighResTimeStamp,
};
export class PerformanceMark extends PerformanceEntry {
@@ -53,12 +53,12 @@ export class PerformanceMark extends PerformanceEntry {
export class PerformanceMeasure extends PerformanceEntry {
#detail: DetailType;
constructor(measureName: string, measureOptions?: PerformanceMeasureInit) {
constructor(measureName: string, measureOptions: PerformanceMeasureInit) {
super({
name: measureName,
entryType: 'measure',
startTime: measureOptions?.startTime ?? 0,
duration: measureOptions?.duration ?? 0,
startTime: measureOptions.startTime,
duration: measureOptions.duration,
});
if (measureOptions) {