-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
types.ts
42 lines (38 loc) · 1.38 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { DocumentNode } from 'graphql';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
import { OperationVariables, DefaultContext, ApolloCache } from '../../core';
import {
QueryFunctionOptions,
QueryResult,
BaseMutationOptions,
MutationFunction,
MutationResult,
BaseSubscriptionOptions,
SubscriptionResult
} from '../types/types';
export interface QueryComponentOptions<
TData = any,
TVariables = OperationVariables
> extends QueryFunctionOptions<TData, TVariables> {
children: (result: QueryResult<TData, TVariables>) => JSX.Element | null;
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
}
export interface MutationComponentOptions<
TData = any,
TVariables = OperationVariables,
TContext = DefaultContext,
TCache extends ApolloCache<any> = ApolloCache<any>
> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {
mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
children: (
mutateFunction: MutationFunction<TData, TVariables, TContext>,
result: MutationResult<TData>
) => JSX.Element | null;
}
export interface SubscriptionComponentOptions<
TData = any,
TVariables = OperationVariables
> extends BaseSubscriptionOptions<TData, TVariables> {
subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;
children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);
}