@zendesk/react-measure-timing-hooks
Version:
react hooks for measuring time to interactive and time to render of components
27 lines (22 loc) • 935 B
text/typescript
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<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TraceManagerT extends TraceManager<any>,
> = TraceManagerT extends TraceManager<infer RelationSchemasT>
? RelationSchemasT
: never