|
| 1 | +import type { Ref } from 'vue' |
| 2 | +import type { |
| 3 | + UseQueryArgs, |
| 4 | + UseQueryResponse, |
| 5 | + UseMutationResponse, |
| 6 | + UseSubscriptionResponse, |
| 7 | + UseSubscriptionArgs, |
| 8 | +} from '@urql/vue' |
| 9 | + |
| 10 | +declare type MaybeRef<T> = T | Ref<T> |
| 11 | + |
1 | 12 | declare module 'virtual:gql-generation' {
|
2 | 13 | export const generated: string[]
|
3 | 14 | }
|
4 | 15 |
|
5 | 16 | declare module 'vql' {
|
6 |
| - import type { |
7 |
| - UseQueryArgs, |
8 |
| - UseQueryResponse, |
9 |
| - UseMutationResponse, |
10 |
| - UseSubscriptionResponse, |
11 |
| - UseSubscriptionArgs, |
12 |
| - UseQueryResponse, |
13 |
| - } from '@urql/vue' |
14 |
| - |
15 |
| - declare type UseQueryOptions = Omit<UseQueryArgs, 'variables'> |
16 |
| - |
17 |
| - // Query |
18 |
| - export function useQuery<T = any, V = any>( |
19 |
| - variables?: UseQueryArgs.variables<T, V> | null, |
20 |
| - options?: Partial<UseQueryOptions<T, V>>): UseQueryResponse<T, V> |
21 |
| - |
22 |
| - export function useQuery<T = any, V = any>( |
23 |
| - queryName?: string, |
24 |
| - variables: UseQueryArgs.variables<T, V>, |
25 |
| - options?: Partial<UseQueryOptions<T, V>>): UseQueryResponse<T, V> |
26 |
| - |
27 |
| - // Mutation |
28 |
| - export function useMutation<T = any, V = any>(query?: string): UseMutationResponse<T, V> |
29 |
| - |
30 |
| - // Subscriptions |
31 |
| - export function useSubscription<T = any, R = T, V = object>( |
32 |
| - variables: UseSubscriptionArgs.variables<T, V>, |
33 |
| - _args?: Partial<UseSubscriptionArgs<T, V>>, |
34 |
| - handler?: MaybeRef<SubscriptionHandler<T, R>>): UseSubscriptionResponse<T, R, V> |
35 |
| - |
36 |
| - export function useSubscription<T = any, R = T, V = object>( |
37 |
| - queryName: string, |
38 |
| - variables: UseSubscriptionArgs.variables<T, V>, |
39 |
| - _args?: Partial<UseSubscriptionArgs<T, V>>, |
40 |
| - handler?: MaybeRef<SubscriptionHandler<T, R>>): UseSubscriptionResponse<T, R, V> |
| 17 | + |
| 18 | + export declare function useQuery<T = any, V = object>(_args: Omit<UseQueryArgs<T, V>, 'query'>): UseQueryResponse<T, V> |
| 19 | + export declare function useQuery<T = any, V = object>(name: string, _args: Omit<UseQueryArgs<T, V>, 'query'>): UseQueryResponse<T, V> |
| 20 | + |
| 21 | + export declare function useMutation<T = any, V = any>(): UseMutationResponse<T, V> |
| 22 | + export declare function useMutation<T = any, V = any>(name: string): UseMutationResponse<T, V> |
| 23 | + |
| 24 | + export declare function useSubscription<T = any, R = T, V = object>(_args: Omit<UseSubscriptionArgs<T, V>, 'query'>, handler?: MaybeRef<SubscriptionHandler<T, R>>): UseSubscriptionResponse<T, R, V> |
| 25 | + export declare function useSubscription<T = any, R = T, V = object>(name: string, _args: Omit<UseSubscriptionArgs<T, V>, 'query'>, handler?: MaybeRef<SubscriptionHandler<T, R>>): UseSubscriptionResponse<T, R, V> |
41 | 26 | }
|
42 | 27 |
|
43 | 28 | declare module 'vql-gen' {
|
44 | 29 |
|
45 |
| - interface Variable { |
46 |
| - [name: string]: any |
47 |
| - } |
48 |
| - |
49 |
| - interface Variables { |
| 30 | + export interface UseQueryDynamicVariable { |
50 | 31 | for: string
|
51 |
| - variables: Variable |
| 32 | + variables: MaybeRef<V> |
52 | 33 | }
|
53 | 34 |
|
54 |
| - export function useQuery<T = any, V = any>(variables?: Variables[], options?: Partial<UseQueryOptions<T, V>>): UseQueryResponse<T, V> |
| 35 | + export interface UseDyanmicQueryArgs<T, V> extends Omit<UseQueryArgs<T, V>, ['query', 'variables']> { |
| 36 | + variables: UseQueryDynamicVariable<V> |
| 37 | + } |
55 | 38 |
|
| 39 | + export declare function useQuery<T = any, V = object>(_args: UseDyanmicQueryArgs<T, V>): UseQueryResponse<T, V> |
56 | 40 | }
|
0 commit comments