From 825e6c0f6128bc15b252b5502101d3d0b1e76732 Mon Sep 17 00:00:00 2001 From: Yury Savin Date: Sun, 17 Dec 2023 22:14:07 +0100 Subject: [PATCH 1/2] feat(useLazyQuery): add interface for lazy query return --- 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..f7bb933a 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/index.js' + +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 ( From 42db4d57da8dff3285d9971b6cdb1358e84a8601 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Mon, 15 Jan 2024 09:50:51 +0100 Subject: [PATCH 2/2] fix: type import from apollo client --- packages/vue-apollo-composable/src/useLazyQuery.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vue-apollo-composable/src/useLazyQuery.ts b/packages/vue-apollo-composable/src/useLazyQuery.ts index f7bb933a..41deacff 100644 --- a/packages/vue-apollo-composable/src/useLazyQuery.ts +++ b/packages/vue-apollo-composable/src/useLazyQuery.ts @@ -1,7 +1,7 @@ import { DocumentNode } from 'graphql' import { isRef } from 'vue-demi' import { useQueryImpl, DocumentParameter, VariablesParameter, OptionsParameter, UseQueryOptions, UseQueryReturn } from './useQuery' -import type { OperationVariables } from '@apollo/client/core/index.js' +import type { OperationVariables } from '@apollo/client/core' export interface UseLazyQueryReturn extends UseQueryReturn { load: (document?: DocumentNode | null, variables?: TVariables | null, options?: UseQueryOptions | null) => false | Promise