import { Storage } from '../identity/types.cjs'; import './use-visibility-detection.cjs'; type Primitives = string | number | boolean | null; type Arr = AllowedValue[]; type Obj = { [key in string]: AllowedValue; } & { [key in string]?: AllowedValue | undefined; }; type AllowedValue = Primitives | Arr | Obj; type SharedOptions = { key: string; /** * Called each time the value in storage changes or is loaded. * * You can modify the value before it is set in the state. */ preprocessValue?: (value: Exclude) => TValue; /** * @defaultValue WebStorage */ storage?: Storage; }; type UseStorageWithoutInitialValue = { initialValue?: never; } & SharedOptions; type UseStorageOptionsWithInitialValue = { initialValue: TValue; } & SharedOptions; type Setter = (value: TValue | ((prevState: TValue) => TValue)) => Promise; declare function useStorage(options: UseStorageWithoutInitialValue): [TValue | undefined, Setter]; declare function useStorage(options: UseStorageOptionsWithInitialValue): [TValue, Setter]; export { useStorage };