/** @tossdocs-ignore */ import { Storage } from '@toss/storage'; import { SetStateAction } from 'react'; declare type ToPrimitive = T extends string ? string : T extends number ? number : T extends boolean ? boolean : never; declare type ToObject = T extends unknown[] | Record ? T : never; export declare type Serializable = T extends string | number | boolean ? ToPrimitive : ToObject; interface StorageStateOptions { storage?: Storage; defaultValue?: Serializable; } interface StorageStateOptionsWithDefaultValue extends StorageStateOptions { defaultValue: Serializable; } /** * 스토리지에 상태값을 저장하고 불러와서 값이 보존되는 useState로 동작하는 hook입니다. * @param key 스토리지에 저장할 키 */ export declare function useStorageState(key: string): readonly [Serializable | undefined, (value: SetStateAction | undefined>) => void, () => void]; export declare function useStorageState(key: string, { storage, defaultValue }: StorageStateOptionsWithDefaultValue): readonly [Serializable, (value: SetStateAction>) => void, () => void]; export declare function useStorageState(key: string, { storage, defaultValue }: StorageStateOptions): readonly [Serializable | undefined, (value: SetStateAction | undefined>) => void, () => void]; export {};