export type KeepDirection = 'beginning' | 'ending'; export type BoundedArrayControl = { /** * Add elements to the end of the array. * Clips array by specified "maxSize". * Ensures, that last item won't be clipped. */ push: (items: T[]) => boolean; /** * Add elements to the beginning of the array. * Clips array by specified "maxSize". * Ensures, that first item won't be clipped. */ unshift: (items: T[]) => boolean; /** * Set all elements to the array. * Clips array by specified "maxSize". * Keeps elements according to "keep" argument's value: * beginning - array will be clipped from the end. * ending - array will be clipped from the beginning. */ set: (items: T[], keep: KeepDirection) => boolean; insert: (item: T, index: number, keep: KeepDirection) => boolean; /** * Works exactly like "Array.prototype.at". */ at: (index: number) => T | undefined; /** * Returns reference to current array. */ getAll: () => readonly T[]; /** * Sets state to the old one in order to rerender. */ refresh: () => void; }; export declare const useBoundedArray: (initial: T[], maxChunkSize: number) => [items: T[], control: BoundedArrayControl];