import { FixedSizeList } from 'react-window' ; import type { NodeData , NodePublicState , NodeRecord , TreeCreatorOptions , TreeProps , TreeState , TypedListChildComponentData , } from './Tree' ; export type Mutable < T > = { - readonly [ P in keyof T ] : T [ P ] ; } ; export type RequestIdleCallbackHandle = any ; export type RequestIdleCallbackOptions = Readonly < { timeout : number ; } > ; export type RequestIdleCallbackDeadline = Readonly < { didTimeout : boolean ; timeRemaining : ( ) => number ; } > ; declare global { const requestIdleCallback ; const cancelIdleCallback ; interface Window { requestIdleCallback : typeof requestIdleCallback ; cancelIdleCallback : typeof cancelIdleCallback ; } } export type DefaultTreeProps = TreeProps < NodeData , NodePublicState < NodeData > , FixedSizeList > ; export type DefaultTreeState = TreeState < NodeData , NodePublicState < NodeData > , FixedSizeList > ; export type DefaultTreeCreatorOptions = TreeCreatorOptions < NodeData , NodePublicState < NodeData > , DefaultTreeState > ; export const noop = ( ) : void => { } ; export const identity = < T > ( value ) : T => value ; export const createBasicRecord = < TData extends NodeData , TNodePublicState extends NodePublicState < TData > > ( pub , parent = null ) : NodeRecord < TNodePublicState > => ( { child : null , isShown : parent ? parent . public . isOpen && parent . isShown : true , parent , public : pub , sibling : null , visited : false , } ) ; export const getIdByIndex = < TData extends NodeData , TNodePublicState extends NodePublicState < TData > > ( index , { getRecordData } ) : string => { const { data : { id } , } = getRecordData ( index ) ; return id ; } ;