/** * A React hook for managing a list of items. The returned list can be modified * using the following methods: * * **Mutating methods:** * - `applyWhere`: Applies a callback function to each item in the list that * matches the condition. * - `clear`: Removes all items from the list. * - `filter`: Removes all items from the list that do not match the condition. * - `insert`: Inserts items at the specified index in the list. * - `map`: Applies a callback function to each item in the list. * - `move`: Moves an item from one index to another. * - `moveDown`: Moves an item one position down (increases index). * - `moveUp`: Moves an item one position up (decreases index). * - `pop`: Removes the last item from the list. * - `prepend`: Inserts items at the beginning of the list. * - `push`: Adds new items to the end of the list. * - `remove`: Removes the items at the specified indices from the list. * - `removeIf`: Removes all items matching a condition. * - `replaceWhere`: Replaces all items matching a condition with a new value. * - `set`: Replaces the current list with the new items. * - `shift`: Removes the first item from the list. * - `sort`: Sorts the list using a compare function. * - `swap`: Swaps two items by their indices. * - `toggle`: Adds an item if not present, removes it if already present. * - `updateAt`: Updates the item at a specific index, or the first item * matching a predicate. * * **Read-only methods:** * - `chunk`: Splits the list into groups of a given size. * - `every`: Checks whether all items match a condition. * - `findIndex`: Returns the index of the first item matching a condition. * - `first`: Returns the first item, or `undefined` if the list is empty. * - `includes`: Checks whether an item (or an item matching a predicate) * exists in the list. * - `indexOf`: Returns the index of an item using `===`, or `-1`. * - `isEmpty`: Returns `true` if the list has no items. * - `isFirst`: Checks whether an item is at the first position. * - `isLast`: Checks whether an item is at the last position. * - `keys`: Returns an array of all indices in the list. * - `last`: Returns the last item, or `undefined` if the list is empty. * - `slice`: Returns a shallow copy of a portion of the list. * - `some`: Checks whether at least one item matches a condition. * * **Utility methods:** * - `reverse`: Reverses the list (immutable). * - `unique`: Removes duplicate items, optionally by a key function. * * The hook returns an array with two elements. The first element is the list * itself, and the second element is an object with the above methods. * * @param initialValue The initial value of the list (defaults to `[]`). * @returns A tuple containing the list and an object with the above methods. */ export declare function useList(initialValue?: T[]): readonly [T[], { readonly applyWhere: (condition: (item: T) => boolean, fn: (value: T) => T) => void; readonly chunk: (size: number) => T[][]; readonly clear: () => void; readonly every: (predicate: (item: T, index: number) => boolean) => boolean; readonly filter: (fn: (value: T) => boolean) => void; readonly findIndex: (predicate: (item: T, index: number) => boolean) => number; readonly first: () => T; readonly includes: (itemOrPredicate: T | ((item: T) => boolean)) => boolean; readonly indexOf: (item: T) => number; readonly insert: (index: number, ...items: T[]) => void; readonly isEmpty: () => boolean; readonly isFirst: (index: number) => boolean; readonly isLast: (index: number) => boolean; readonly keys: () => string[]; readonly last: () => T; readonly map: (callback: (value: T) => T) => void; readonly move: (from: number, to: number) => void; readonly moveDown: (index: number) => void; readonly moveUp: (index: number) => void; readonly pop: () => void; readonly prepend: (...items: T[]) => void; readonly push: (...items: T[]) => void; readonly remove: (...indices: number[]) => void; readonly removeIf: (condition: (item: T) => boolean) => void; readonly replaceWhere: (condition: (item: T) => boolean, item: T) => void; readonly reverse: () => void; readonly set: (...items: T[]) => void; readonly shift: () => void; readonly slice: (start: number, end?: number) => T[]; readonly some: (predicate: (item: T, index: number) => boolean) => boolean; readonly sort: (comparator: (a: T, b: T) => number) => void; readonly swap: (i: number, j: number) => void; readonly toggle: (item: T) => void; readonly unique: (keyFn?: (item: T) => unknown) => void; readonly updateAt: (indexOrPredicate: number | ((item: T) => boolean), item: T) => void; }];