UNPKG

1.29 kBTypeScriptView Raw
1import type { DeepPartial } from "../../utilities/index.js";
2import type { Cache, Reference, StoreObject, MissingTree } from "../../cache/index.js";
3import type { ApolloClient, OperationVariables } from "../../core/index.js";
4import type { NoInfer } from "../types/types.js";
5export interface UseFragmentOptions<TData, TVars> extends Omit<Cache.DiffOptions<NoInfer<TData>, NoInfer<TVars>>, "id" | "query" | "optimistic" | "previousResult" | "returnPartialData">, Omit<Cache.ReadFragmentOptions<TData, TVars>, "id" | "variables" | "returnPartialData"> {
6 from: StoreObject | Reference | string;
7 optimistic?: boolean;
8 /**
9 * The instance of `ApolloClient` to use to look up the fragment.
10 *
11 * By default, the instance that's passed down via context is used, but you
12 * can provide a different instance here.
13 *
14 * @docGroup 1. Operation options
15 */
16 client?: ApolloClient<any>;
17}
18export type UseFragmentResult<TData> = {
19 data: TData;
20 complete: true;
21 missing?: never;
22} | {
23 data: DeepPartial<TData>;
24 complete: false;
25 missing?: MissingTree;
26};
27export declare function useFragment<TData = any, TVars = OperationVariables>(options: UseFragmentOptions<TData, TVars>): UseFragmentResult<TData>;
28//# sourceMappingURL=useFragment.d.ts.map
\No newline at end of file