Files
apollo/types/vue-apollo.d.ts
T
Frank Dugan III 937094cfcc Add Typescript type for addSmartQuery() (#230)
Currently, there are no Typescript definitions for `addSmartQuery`. This PR adds one line to cover that edge case.
2018-05-21 19:45:17 +02:00

28 lines
1.4 KiB
TypeScript

import Vue, { PluginObject, PluginFunction } from 'vue';
import { DocumentNode } from 'graphql';
import { ApolloClient } from 'apollo-client';
import { SubscriptionOptions, ObservableQuery } from 'apollo-client'
import { DataProxy } from 'apollo-cache';
import { subscribe } from 'graphql/subscription/subscribe';
import { ApolloProvider, VueApolloComponent } from './apollo-provider'
import { VueApolloQueryOptions, VueApolloMutationOptions, VueApolloSubscriptionOptions, ApolloVueThisType, VueApolloOptions } from './options'
export class VueApollo extends ApolloProvider implements PluginObject<{}>{
[key: string]: any;
install: PluginFunction<{}>;
constructor (options: { defaultClient: ApolloClient<{}>, defaultOptions?: VueApolloOptions, clients?: { [key: string]: ApolloClient<{}> } });
static install(pVue: typeof Vue, options?:{} | undefined): void;
}
type Query<V> = (key: string, options: VueApolloQueryOptions<V, any>) => void;
type Mutate<V, R=any> = <R=any>(params: VueApolloMutationOptions<V, R>) => Promise<R>;
type Subscribe<R=any> = <R=any>(params: SubscriptionOptions) => ObservableQuery<R>;
export interface ApolloProperty<V> {
[key: string]: Query<V> | Mutate<V> | Subscribe; // smart query
queries: any;
mutate: Mutate<V>;
subscribe: Subscribe;
addSmartQuery: Query<V>;
}
export function willPrefetch (component: VueApolloComponent, contextCallback?: boolean): VueApolloComponent