Skip to content

Commit 2746efa

Browse files
baitunAkryum
andauthored
feat(useLazyQuery): add interface for lazy query return (#1523)
Co-authored-by: Guillaume Chau <[email protected]>
1 parent fb66dce commit 2746efa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/vue-apollo-composable/src/useLazyQuery.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { DocumentNode } from 'graphql'
22
import { isRef } from 'vue-demi'
3-
import { useQueryImpl, DocumentParameter, VariablesParameter, OptionsParameter, UseQueryOptions } from './useQuery'
3+
import { useQueryImpl, DocumentParameter, VariablesParameter, OptionsParameter, UseQueryOptions, UseQueryReturn } from './useQuery'
4+
import type { OperationVariables } from '@apollo/client/core'
5+
6+
export interface UseLazyQueryReturn<TResult, TVariables extends OperationVariables> extends UseQueryReturn<TResult, TVariables> {
7+
load: (document?: DocumentNode | null, variables?: TVariables | null, options?: UseQueryOptions | null) => false | Promise<TResult>
8+
}
49

510
export function useLazyQuery<
611
TResult = any,
@@ -9,7 +14,7 @@ export function useLazyQuery<
914
document: DocumentParameter<TResult, TVariables>,
1015
variables?: VariablesParameter<TVariables>,
1116
options?: OptionsParameter<TResult, TVariables>,
12-
) {
17+
): UseLazyQueryReturn<TResult, TVariables> {
1318
const query = useQueryImpl<TResult, TVariables>(document, variables, options, true)
1419

1520
function load (

0 commit comments

Comments
 (0)