1.0.3 • Published 6 months ago
@types/react-component-benchmark v1.0.3
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.
index.d.ts
// Type definitions for react-component-benchmark 1.0
// Project: https://github.com/paularmstrong/react-component-benchmark
// Definitions by: Yi Fan <https://github.com/yifanwww>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
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: Sun, 14 Nov 2021 03:31:21 GMT
- Dependencies: @types/react
- Global values: none
Credits
These definitions were written by Yi Fan.