UNPKG

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