import { SetStateAction, WritableAtom } from 'jotai';
import { RESET } from './constants';
declare type Unsubscribe = () => void;
declare type AsyncStorage<Value> = {
    getItem: (key: string) => Promise<Value>;
    setItem: (key: string, newValue: Value) => Promise<void>;
    removeItem: (key: string) => Promise<void>;
    delayInit?: boolean;
    subscribe?: (key: string, callback: (value: Value) => void) => Unsubscribe;
};
declare type SyncStorage<Value> = {
    getItem: (key: string) => Value;
    setItem: (key: string, newValue: Value) => void;
    removeItem: (key: string) => void;
    delayInit?: boolean;
    subscribe?: (key: string, callback: (value: Value) => void) => Unsubscribe;
};
declare type AsyncStringStorage = {
    getItem: (key: string) => Promise<string | null>;
    setItem: (key: string, newValue: string) => Promise<void>;
    removeItem: (key: string) => Promise<void>;
};
declare type SyncStringStorage = {
    getItem: (key: string) => string | null;
    setItem: (key: string, newValue: string) => void;
    removeItem: (key: string) => void;
};
export declare function createJSONStorage<Value>(getStringStorage: () => AsyncStringStorage): AsyncStorage<Value>;
export declare function createJSONStorage<Value>(getStringStorage: () => SyncStringStorage): SyncStorage<Value>;
export declare function atomWithStorage<Value>(key: string, initialValue: Value, storage: AsyncStorage<Value> & {
    delayInit: true;
}): WritableAtom<Value, SetStateAction<Value> | typeof RESET, Promise<void>>;
export declare function atomWithStorage<Value>(key: string, initialValue: Value, storage: AsyncStorage<Value>): WritableAtom<Promise<Value>, SetStateAction<Value> | typeof RESET, Promise<void>>;
export declare function atomWithStorage<Value>(key: string, initialValue: Value, storage: SyncStorage<Value>): WritableAtom<Value, SetStateAction<Value> | typeof RESET>;
export declare function atomWithStorage<Value>(key: string, initialValue: Value): WritableAtom<Value, SetStateAction<Value> | typeof RESET>;
export declare function atomWithHash<Value>(key: string, initialValue: Value, options?: {
    serialize?: (val: Value) => string;
    deserialize?: (str: string) => Value;
    delayInit?: boolean;
    replaceState?: boolean;
    subscribe?: (callback: () => void) => () => void;
}): WritableAtom<Value, SetStateAction<Value> | typeof RESET>;
export {};
