UNPKG

1.27 kBTypeScriptView Raw
1import type { QueryKey, QueryObserverOptions } from 'react-query';
2import type { WritableAtom } from 'jotai';
3import type { CreateQueryOptions, GetQueryClient } from './types';
4export declare type AtomWithQueryAction = {
5 type: 'refetch';
6};
7export declare type AtomWithQueryOptions<TQueryFnData, TError, TData, TQueryData> = QueryObserverOptions<TQueryFnData, TError, TData, TQueryData> & {
8 queryKey: QueryKey;
9};
10export declare type AtomWithQueryOptionsWithEnabled<TQueryFnData, TError, TData, TQueryData> = Omit<AtomWithQueryOptions<TQueryFnData, TError, TData, TQueryData>, 'enabled'> & {
11 enabled: boolean;
12};
13export declare function atomWithQuery<TQueryFnData, TError, TData = TQueryFnData, TQueryData = TQueryFnData>(createQuery: CreateQueryOptions<AtomWithQueryOptionsWithEnabled<TQueryFnData, TError, TData, TQueryData>>, getQueryClient?: GetQueryClient): WritableAtom<TData | TQueryData | undefined, AtomWithQueryAction, Promise<void>>;
14export declare function atomWithQuery<TQueryFnData, TError, TData = TQueryFnData, TQueryData = TQueryFnData>(createQuery: CreateQueryOptions<AtomWithQueryOptions<TQueryFnData, TError, TData, TQueryData>>, getQueryClient?: GetQueryClient): WritableAtom<TData | TQueryData, AtomWithQueryAction, Promise<void>>;