From 2746efa632571b05eca1dc4fe9b4f56bebabe434 Mon Sep 17 00:00:00 2001 From: Yury Savin Date: Mon, 15 Jan 2024 10:04:12 +0100 Subject: [PATCH] feat(useLazyQuery): add interface for lazy query return (#1523) Co-authored-by: Guillaume Chau --- packages/vue-apollo-composable/src/useLazyQuery.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/vue-apollo-composable/src/useLazyQuery.ts b/packages/vue-apollo-composable/src/useLazyQuery.ts index 5e80a310..41deacff 100644 --- a/packages/vue-apollo-composable/src/useLazyQuery.ts +++ b/packages/vue-apollo-composable/src/useLazyQuery.ts @@ -1,6 +1,11 @@ import { DocumentNode } from 'graphql' import { isRef } from 'vue-demi' -import { useQueryImpl, DocumentParameter, VariablesParameter, OptionsParameter, UseQueryOptions } from './useQuery' +import { useQueryImpl, DocumentParameter, VariablesParameter, OptionsParameter, UseQueryOptions, UseQueryReturn } from './useQuery' +import type { OperationVariables } from '@apollo/client/core' + +export interface UseLazyQueryReturn extends UseQueryReturn { + load: (document?: DocumentNode | null, variables?: TVariables | null, options?: UseQueryOptions | null) => false | Promise +} export function useLazyQuery< TResult = any, @@ -9,7 +14,7 @@ export function useLazyQuery< document: DocumentParameter, variables?: VariablesParameter, options?: OptionsParameter, -) { +): UseLazyQueryReturn { const query = useQueryImpl(document, variables, options, true) function load (