UNPKG

1.62 kBTypeScriptView Raw
1import * as O from 'optics-ts';
2import type { SetStateAction, WritableAtom } from 'jotai';
3declare type NonFunction<T> = [T] extends [(...args: any[]) => any] ? never : T;
4export declare function focusAtom<S, A, R extends void | Promise<void>>(baseAtom: WritableAtom<Promise<S>, NonFunction<S>, R>, callback: (optic: O.OpticFor<S>) => O.Prism<S, any, A>): WritableAtom<A | undefined, SetStateAction<A>, R>;
5export declare function focusAtom<S, A, R extends void | Promise<void>>(baseAtom: WritableAtom<Promise<S>, NonFunction<S>, R>, callback: (optic: O.OpticFor<S>) => O.Traversal<S, any, A>): WritableAtom<A[], SetStateAction<A>, R>;
6export declare function focusAtom<S, A, R extends void | Promise<void>>(baseAtom: WritableAtom<Promise<S>, NonFunction<S>, R>, callback: (optic: O.OpticFor<S>) => O.Lens<S, any, A> | O.Equivalence<S, any, A> | O.Iso<S, any, A>): WritableAtom<A, SetStateAction<A>, R>;
7export declare function focusAtom<S, A, R extends void | Promise<void>>(baseAtom: WritableAtom<S, NonFunction<S>, R>, callback: (optic: O.OpticFor<S>) => O.Prism<S, any, A>): WritableAtom<A | undefined, SetStateAction<A>, R>;
8export declare function focusAtom<S, A, R extends void | Promise<void>>(baseAtom: WritableAtom<S, NonFunction<S>, R>, callback: (optic: O.OpticFor<S>) => O.Traversal<S, any, A>): WritableAtom<A[], SetStateAction<A>, R>;
9export declare function focusAtom<S, A, R extends void | Promise<void>>(baseAtom: WritableAtom<S, NonFunction<S>, R>, callback: (optic: O.OpticFor<S>) => O.Lens<S, any, A> | O.Equivalence<S, any, A> | O.Iso<S, any, A>): WritableAtom<A, SetStateAction<A>, R>;
10export {};