interface AtomResetOptions { resetValue?: boolean; clearPersisted?: boolean; } interface ReadOnlyAtomInterface { readonly value: V; readonly initialValue: V; subscribe: (callback: (value: V, previousValue?: V) => void, immediate?: boolean) => string; unsubscribe: (subId: string) => boolean; reset(options?: AtomResetOptions): Promise; } interface AtomInterface extends ReadOnlyAtomInterface { value: V; } type AnyFunction = (...args: any[]) => any; type MaybePromisify = T | Promise; type PromisifyMethods = { [K in keyof T]: T[K] extends AnyFunction ? (...args: Parameters) => MaybePromisify> : T[K]; }; export type SupportedStorage = PromisifyMethods>; export interface AtomMemoizationOptions { type: 'shallow' | 'deep' | 'custom'; compare?: (a: V, b: V) => boolean; } export interface AtomPersistenceOptions { persistKey: string; storage?: SupportedStorage; } export interface AtomOptions { persistence?: AtomPersistenceOptions; memoization?: AtomMemoizationOptions; } declare class Atom implements AtomInterface { private _value; private _initialValue; private subscribers; private persistence?; private memoization?; constructor(initialValue: V, options?: AtomOptions); private hydrate; private shouldSkipUpdate; private notifySubscribers; get initialValue(): V; get value(): V; set value(newValue: V); subscribe(callback: (value: V, previousValue?: V) => void, immediate?: boolean): string; unsubscribe(subId: string): boolean; reset(options?: AtomResetOptions): Promise; } export { Atom, AtomInterface, ReadOnlyAtomInterface };