UNPKG

761 BTypeScriptView Raw
1import React from 'react';
2import { Atom, WritableAtom, AnyAtom } from './types';
3export declare type AtomState<Value = unknown> = {
4 readE?: Error;
5 readP?: Promise<void>;
6 writeP?: Promise<void>;
7 value: Value;
8};
9declare type State = Map<AnyAtom, AtomState>;
10export declare type Actions = {
11 add: <Value>(id: symbol, atom: Atom<Value>) => void;
12 del: (id: symbol) => void;
13 read: <Value>(state: State, atom: Atom<Value>) => AtomState<Value>;
14 write: <Value, Update>(atom: WritableAtom<Value, Update>, update: Update) => void | Promise<void>;
15};
16export declare const ActionsContext: React.Context<Actions>;
17export declare const StateContext: React.Context<State>;
18export declare const Provider: React.FC;
19export {};