UNPKG

@zendesk/react-measure-timing-hooks

Version:

react hooks for measuring time to interactive and time to render of components

18 lines (17 loc) 880 B
import type { Attributes } from './spanTypes'; import type { TraceManager } from './TraceManager'; import type { RelatedTo } from './types'; export type RenderedOutput = 'null' | 'loading' | 'content' | 'error'; export type BeaconConfig<RelationSchemasT, RequiredAttributesT = {}> = { name: string; relatedTo: RelatedTo<RelationSchemasT>; renderedOutput: RenderedOutput; isIdle?: boolean; error?: Error; } & (keyof RequiredAttributesT extends never ? { attributes?: Attributes; } : { attributes: RequiredAttributesT & Attributes; }); export type UseBeacon<RelationSchemasT, RequiredAttributesT> = (beaconConfig: BeaconConfig<RelationSchemasT, RequiredAttributesT>) => void; export type GetRelationSchemasTFromTraceManager<TraceManagerT extends TraceManager<any>> = TraceManagerT extends TraceManager<infer RelationSchemasT> ? RelationSchemasT : never;