Installation
npm install --save @types/react-component-benchmark
Summary
This package contains type definitions for react-component-benchmark (https://github.com/paularmstrong/react-component-benchmark).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-component-benchmark.
import { ComponentType, ForwardRefExoticComponent, RefAttributes } from "react";
export const BenchmarkType: {
MOUNT: "mount";
UPDATE: "update";
UNMOUNT: "unmount";
};
export interface Sample {
start: number;
end: number;
elapsed: number;
layout: number;
}
export interface ComputedResult {
max: number;
min: number;
median: number;
mean: number;
stdDev: number;
p70: number;
p95: number;
p99: number;
}
export interface BenchResultsType extends ComputedResult {
startTime: number;
endTime: number;
runTime: number;
sampleCount: number;
samples: Sample[];
layout?: ComputedResult;
}
export interface BenchmarkProps {
component: ComponentType<any>;
componentProps?: Record<string, unknown>;
/** Default is `false`. */
includeLayout?: boolean;
onComplete: (res: BenchResultsType) => void;
samples: number;
/** Default is `10000`. */
timeout?: number;
/** Default is `BenchmarkType.MOUNT`. */
type?: typeof BenchmarkType[keyof typeof BenchmarkType];
}
export interface BenchmarkRef {
start: () => void;
}
declare const Benchmark: ForwardRefExoticComponent<BenchmarkProps & RefAttributes<BenchmarkRef>>;
export default Benchmark;
Additional Details
- Last updated: Tue, 07 Nov 2023 09:09:39 GMT
- Dependencies: @types/react
Credits
These definitions were written by Yi Fan.