UNPKG

720 BTypeScriptView Raw
1import type { Atom, PrimitiveAtom, WritableAtom } from 'jotai';
2type SplitAtomAction<Item> = {
3 type: 'remove';
4 atom: PrimitiveAtom<Item>;
5} | {
6 type: 'insert';
7 value: Item;
8 before?: PrimitiveAtom<Item>;
9} | {
10 type: 'move';
11 atom: PrimitiveAtom<Item>;
12 before?: PrimitiveAtom<Item>;
13};
14type DeprecatedAtomToRemove<Item> = PrimitiveAtom<Item>;
15export declare function splitAtom<Item, Key>(arrAtom: WritableAtom<Item[], Item[]>, keyExtractor?: (item: Item) => Key): WritableAtom<PrimitiveAtom<Item>[], SplitAtomAction<Item> | DeprecatedAtomToRemove<Item>>;
16export declare function splitAtom<Item, Key>(arrAtom: Atom<Item[]>, keyExtractor?: (item: Item) => Key): Atom<Atom<Item>[]>;
17export {};