Skip to content

Commit f4b8ab3

Browse files
committed
Capture returnPartialData in a separate generic arg
1 parent 71f6ee3 commit f4b8ab3

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

src/react/hooks/useQuery.ts

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export declare namespace useQuery {
205205
| Record<string, never> // no options
206206
| Options<TData, TVariables>
207207
| SkipToken,
208+
TReturnPartialData extends boolean | undefined = undefined,
208209
> = LazyType<
209210
Result<
210211
TData,
@@ -215,7 +216,7 @@ export declare namespace useQuery {
215216
| (TOptions extends any ?
216217
TOptions extends SkipToken ? never
217218
: OptionWithFallback<
218-
TOptions,
219+
{ returnPartialData: TReturnPartialData },
219220
DefaultOptions,
220221
"returnPartialData"
221222
> extends false ?
@@ -547,16 +548,23 @@ export declare namespace useQuery {
547548
>]?: never;
548549
}
549550
>,
551+
TReturnPartialData extends boolean | undefined = undefined,
550552
>(
551553
query: DocumentNode | TypedDocumentNode<TData, TVariables>,
552554
...[options]: // we generally do not allow for a `TVariables` of `never`
553555
// TODO: check if we need a similar check in other hooks
554556
[TVariables] extends [never] ? [options: never]
555557
: // variables optional
556-
{} extends TVariables ? [options?: TOptions]
558+
{} extends TVariables ?
559+
[options?: TOptions & { returnPartialData?: TReturnPartialData }]
557560
: // variables required
558-
[options: TOptions]
559-
): useQuery.ResultForOptions<TData, TVariables, TOptions>;
561+
[options: TOptions & { returnPartialData?: TReturnPartialData }]
562+
): useQuery.ResultForOptions<
563+
TData,
564+
TVariables,
565+
TOptions,
566+
TReturnPartialData
567+
>;
560568

561569
/** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */
562570
<
@@ -583,16 +591,31 @@ export declare namespace useQuery {
583591
>]?: never;
584592
}
585593
>,
594+
TReturnPartialData extends boolean | undefined = undefined,
586595
>(
587596
query: DocumentNode | TypedDocumentNode<TData, TVariables>,
588597
...[options]: // we generally do not allow for a `TVariables` of `never`
589598
// TODO: check if we need a similar check in other hooks
590599
[TVariables] extends [never] ? [options: never]
591600
: // variables optional
592-
{} extends TVariables ? [options?: TOptions | SkipToken]
601+
{} extends TVariables ?
602+
[
603+
options?:
604+
| (TOptions & { returnPartialData?: TReturnPartialData })
605+
| SkipToken,
606+
]
593607
: // variables required
594-
[options: TOptions | SkipToken]
595-
): useQuery.ResultForOptions<TData, TVariables, TOptions | SkipToken>;
608+
[
609+
options:
610+
| (TOptions & { returnPartialData?: TReturnPartialData })
611+
| SkipToken,
612+
]
613+
): useQuery.ResultForOptions<
614+
TData,
615+
TVariables,
616+
TOptions | SkipToken,
617+
TReturnPartialData
618+
>;
596619

597620
ssrDisabledResult: ObservableQuery.Result<any>;
598621
}

0 commit comments

Comments
 (0)