import type { Dispatch, SetStateAction } from 'react'; type StorageName = 'localStorage' | 'sessionStorage'; type StorageEventMap = { [K in StorageName]: CustomEvent; }; declare global { interface WindowEventMap extends StorageEventMap { } } /** * Represents the options for customizing the behavior of serialization and deserialization. * @template T - The type of the state to be stored in storage. */ type UseStorageOptions = { /** A function to deserialize the stored value. */ deserializer?: (value: string) => T; /** * If `true` (default), the hook will initialize reading the storage. In SSR, you should set it to `false`, returning the initial value initially. * @default true */ initializeWithValue?: boolean; /** A function to serialize the value before storing it. */ serializer?: (value: T) => string; }; /** * Custom hook that uses local or session storage to persist state across page reloads. * @template T - The type of the state to be stored in storage. * @param key - The key under which the value will be stored in storage. * @param initialValue - The initial value of the state or a function that returns the initial value. * @param options - Options for customizing the behavior of serialization and deserialization (optional). * @returns A tuple containing the stored value and a function to set the value. * @public * @example * ```tsx * const [count, setCount] = useStorage('count', 0); * // Access the `count` value and the `setCount` function to update it. * ``` */ export declare function useStorage(key: string, initialValue: (() => T) | T, storageName: StorageName, options?: UseStorageOptions): [T, Dispatch>]; export type { StorageName, UseStorageOptions }; //# sourceMappingURL=useStorage.d.ts.map