@@ -28,6 +28,7 @@ import type {
28
28
import { getSuspenseCache } from "@apollo/client/react/internal" ;
29
29
import { __DEV__ } from "@apollo/client/utilities/environment" ;
30
30
import type {
31
+ DocumentationTypes as UtilityDocumentationTypes ,
31
32
NoInfer ,
32
33
VariablesOption ,
33
34
} from "@apollo/client/utilities/internal" ;
@@ -44,67 +45,96 @@ export declare namespace useSuspenseQuery {
44
45
"cache-first" | "network-only" | "no-cache" | "cache-and-network"
45
46
> ;
46
47
48
+ export namespace Base {
49
+ export interface Options <
50
+ TVariables extends OperationVariables = OperationVariables ,
51
+ > {
52
+ /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member } */
53
+ client ?: ApolloClient ;
54
+
55
+ /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member } */
56
+ context ?: DefaultContext ;
57
+
58
+ /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member } */
59
+ errorPolicy ?: ErrorPolicy ;
60
+
61
+ /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member } */
62
+ returnPartialData ?: boolean ;
63
+
64
+ /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy_suspense:member } */
65
+ refetchWritePolicy ?: RefetchWritePolicy ;
66
+
67
+ /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member } */
68
+ fetchPolicy ?: FetchPolicy ;
69
+
70
+ /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey:member } */
71
+ queryKey ?: string | number | any [ ] ;
72
+
73
+ /**
74
+ * {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip_deprecated:member }
75
+ *
76
+ * @example Recommended usage of `skipToken`:
77
+ * ```ts
78
+ * import { skipToken, useSuspenseQuery } from '@apollo/client';
79
+ *
80
+ * const { data } = useSuspenseQuery(query, id ? { variables: { id } } : skipToken);
81
+ * ```
82
+ */
83
+ skip ?: boolean ;
84
+ }
85
+ }
47
86
export type Options <
48
87
TVariables extends OperationVariables = OperationVariables ,
49
- > = {
50
- /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member } */
51
- client ?: ApolloClient ;
52
-
53
- /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member } */
54
- context ?: DefaultContext ;
55
-
56
- /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member } */
57
- errorPolicy ?: ErrorPolicy ;
88
+ > = Base . Options < TVariables > & VariablesOption < TVariables > ;
89
+
90
+ export namespace DocumentationTypes {
91
+ export interface Options <
92
+ TVariables extends OperationVariables = OperationVariables ,
93
+ > extends Base . Options < TVariables > {
94
+ /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member } */
95
+ variables ?: TVariables ;
96
+ }
97
+ }
58
98
59
- /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member } */
60
- returnPartialData ?: boolean ;
99
+ export namespace Base {
100
+ export interface Result <
101
+ TData = unknown ,
102
+ TVariables extends OperationVariables = OperationVariables ,
103
+ > {
104
+ /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member } */
105
+ client : ApolloClient ;
61
106
62
- /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy_suspense :member } */
63
- refetchWritePolicy ?: RefetchWritePolicy ;
107
+ /** {@inheritDoc @apollo/client!QueryResultDocumentation#error :member } */
108
+ error : ErrorLike | undefined ;
64
109
65
- /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy :member } */
66
- fetchPolicy ?: FetchPolicy ;
110
+ /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore :member } */
111
+ fetchMore : FetchMoreFunction < TData , TVariables > ;
67
112
68
- /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey :member } */
69
- queryKey ?: string | number | any [ ] ;
113
+ /** {@inheritDoc @apollo/client!QueryResultDocumentation#networkStatus :member } */
114
+ networkStatus : NetworkStatus ;
70
115
71
- /**
72
- * {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip_deprecated:member }
73
- *
74
- * @example Recommended usage of `skipToken`:
75
- * ```ts
76
- * import { skipToken, useSuspenseQuery } from '@apollo/client';
77
- *
78
- * const { data } = useSuspenseQuery(query, id ? { variables: { id } } : skipToken);
79
- * ```
80
- */
81
- skip ?: boolean ;
82
- } & VariablesOption < TVariables > ;
116
+ /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member } */
117
+ refetch : RefetchFunction < TData , TVariables > ;
83
118
119
+ /** {@inheritDoc @apollo/client!QueryResultDocumentation#subscribeToMore:member } */
120
+ subscribeToMore : SubscribeToMoreFunction < TData , TVariables > ;
121
+ }
122
+ }
84
123
export type Result <
85
124
TData = unknown ,
86
125
TVariables extends OperationVariables = OperationVariables ,
87
126
TStates extends
88
127
DataState < TData > [ "dataState" ] = DataState < TData > [ "dataState" ] ,
89
- > = {
90
- /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member } */
91
- client : ApolloClient ;
92
-
93
- /** {@inheritDoc @apollo/client!QueryResultDocumentation#error:member } */
94
- error : ErrorLike | undefined ;
95
-
96
- /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member } */
97
- fetchMore : FetchMoreFunction < TData , TVariables > ;
98
-
99
- /** {@inheritDoc @apollo/client!QueryResultDocumentation#networkStatus:member } */
100
- networkStatus : NetworkStatus ;
101
-
102
- /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member } */
103
- refetch : RefetchFunction < TData , TVariables > ;
104
-
105
- /** {@inheritDoc @apollo/client!QueryResultDocumentation#subscribeToMore:member } */
106
- subscribeToMore : SubscribeToMoreFunction < TData , TVariables > ;
107
- } & GetDataState < MaybeMasked < TData > , TStates > ;
128
+ > = Base . Result < TData , TVariables > &
129
+ GetDataState < MaybeMasked < TData > , TStates > ;
130
+
131
+ export namespace DocumentationTypes {
132
+ export interface Result <
133
+ TData = unknown ,
134
+ TVariables extends OperationVariables = OperationVariables ,
135
+ > extends Base . Result < TData , TVariables > ,
136
+ UtilityDocumentationTypes . DataState < TData > { }
137
+ }
108
138
}
109
139
110
140
export function useSuspenseQuery <
0 commit comments