UNPKG

1.03 kBTypeScriptView Raw
1import { WritableAtom } from 'jotai';
2import type { NonPromise, NonFunction, SetStateAction, PrimitiveAtom } from './types';
3export declare const useUpdateAtom: <Value, Update>(anAtom: WritableAtom<Value, Update>) => [Update] extends [never] ? () => void : (update: Update) => void;
4declare const RESET: unique symbol;
5export declare const atomWithReset: <Value>(initialValue: NonFunction<NonPromise<Value>>) => WritableAtom<Value, typeof RESET | NonFunction<Value> | ((prev: Value) => NonFunction<Value>)>;
6export declare const useResetAtom: <Value>(anAtom: WritableAtom<Value, typeof RESET>) => (update: unknown) => void;
7export declare const useReducerAtom: <Value, Action>(anAtom: WritableAtom<Value, SetStateAction<Value>>, reducer: (v: Value, a: Action) => NonFunction<Value>) => readonly [NonPromise<Value>, (action: Action) => void];
8export declare const atomWithReducer: <Value, Action>(initialValue: NonFunction<NonPromise<Value>>, reducer: (v: Value, a: Action) => Value) => WritableAtom<Value, Action>;
9export {};