import type { Getter } from "./Getter.ts"; /** Mutates an array signal without exposing direct write access to the current snapshot. */ export interface ArrayMutator { /** * Appends items to the end of the array. * * @param items - The items to append. * @returns The new array length. */ push(...items: T[]): number; /** * Removes the last item from the array. * * @returns The removed item, if there was one. */ pop(): T | undefined; /** * Prepends items to the beginning of the array. * * @param items - The items to prepend. * @returns The new array length. */ unshift(...items: T[]): number; /** * Removes the first item from the array. * * @returns The removed item, if there was one. */ shift(): T | undefined; /** * Removes and optionally inserts items at the given position. * * @param start - The index at which to start changing the array. * @param deleteCount - The number of items to remove. * @param items - The items to insert at `start`. * @returns The removed items. */ splice(start: number, deleteCount?: number, ...items: T[]): T[]; /** * Replaces the item at the given index. * * @param index - The index of the item to replace. * @param value - The new item value. * @returns The written value. * @throws {@link !RangeError} - When `index` is not a valid existing array index. */ set(index: number, value: T): T; /** * Replaces the item at the given index with a value derived from the current item. * * @param index - The index of the item to replace. * @param update - Derives the new item value from the current one. * @returns The written value. * @throws {@link !RangeError} - When `index` is not a valid existing array index. */ update(index: number, update: (value: T) => T): T; /** * Replaces the whole array content. * * @param items - The new array content. */ replace(items: readonly T[]): void; /** * Removes all items from the array. */ clear(): void; } /** * Creates a signal specialized for array mutation. * * The returned getter exposes readonly array snapshots. Mutations happen through the returned mutator object and invalidate dependents * without requiring array equality checks. * * @param items - The initial array content. * @returns A getter returning readonly snapshots and a mutator for changing the array. */ export declare function createArraySignal(items: readonly T[]): [Getter, ArrayMutator];