This commit is contained in:
nik
2025-10-03 22:27:28 +03:00
parent 829fad0e17
commit 871cf7e792
16520 changed files with 2967597 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
import { useSetAtom } from 'jotai/react';
import type { Getter, Setter } from 'jotai/vanilla';
type Options = Parameters<typeof useSetAtom>[1];
export declare function useAtomCallback<Result, Args extends unknown[]>(callback: (get: Getter, set: Setter, ...arg: Args) => Result, options?: Options): (...args: Args) => Result;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,27 @@
import { useStore } from 'jotai/react';
import type { WritableAtom } from 'jotai/vanilla';
type Options = Parameters<typeof useStore>[0] & {
dangerouslyForceHydrate?: boolean;
};
type AnyWritableAtom = WritableAtom<any, any[], any>;
type InferAtomTuples<T> = {
[K in keyof T]: T[K] extends readonly [
infer A,
...infer Rest
] ? A extends WritableAtom<unknown, infer Args, unknown> ? Rest extends Args ? readonly [
A,
...Rest
] : never : T[K] : never;
};
export type INTERNAL_InferAtomTuples<T> = InferAtomTuples<T>;
export declare function useHydrateAtoms<T extends (readonly [
AnyWritableAtom,
...unknown[]
])[]>(values: InferAtomTuples<T>, options?: Options): void;
export declare function useHydrateAtoms<T extends Map<AnyWritableAtom, unknown>>(values: T, options?: Options): void;
export declare function useHydrateAtoms<T extends Iterable<readonly [
AnyWritableAtom,
...unknown[]
]>>(values: InferAtomTuples<T>, options?: Options): void;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,21 @@
import { useAtom } from 'jotai/react';
import type { PrimitiveAtom } from 'jotai/vanilla';
type Options = Parameters<typeof useAtom>[1];
/**
* @deprecated please use a recipe instead
* https://github.com/pmndrs/jotai/pull/2467
*/
export declare function useReducerAtom<Value, Action>(anAtom: PrimitiveAtom<Value>, reducer: (v: Value, a?: Action) => Value, options?: Options): [
Value,
(action?: Action) => void
];
/**
* @deprecated please use a recipe instead
* https://github.com/pmndrs/jotai/pull/2467
*/
export declare function useReducerAtom<Value, Action>(anAtom: PrimitiveAtom<Value>, reducer: (v: Value, a: Action) => Value, options?: Options): [
Value,
(action: Action) => void
];
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

View File

@@ -0,0 +1,9 @@
import { useSetAtom } from 'jotai/react';
import { RESET } from 'jotai/vanilla/utils';
import type { WritableAtom } from 'jotai/vanilla';
type Options = Parameters<typeof useSetAtom>[1];
export declare function useResetAtom<T>(anAtom: WritableAtom<unknown, [
typeof RESET
], T>, options?: Options): () => T;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;