diff --git a/types/apollo-provider.d.ts b/types/apollo-provider.d.ts index ac7f86d..95319ba 100644 --- a/types/apollo-provider.d.ts +++ b/types/apollo-provider.d.ts @@ -8,7 +8,4 @@ export type VueApolloComponent = VueApolloComponentOption this - prefetchAll: (context: any, components: VueApolloComponent[], options?: { includeGlobal?: boolean }) => Promise[]> - getStates(options?: { exportNamespace?: string }): { [key: string]: any } - exportStates(oprions?: { globalName?: string, attachTo?: string, exportNamespace?: string}): string } diff --git a/types/index.d.ts b/types/index.d.ts index f8f5863..7fa515c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,6 +1,6 @@ import './vue' -import { VueApollo, willPrefetch } from './vue-apollo' +import { VueApollo } from './vue-apollo' import { ApolloProvider } from './apollo-provider' export default VueApollo -export { willPrefetch, ApolloProvider } +export { ApolloProvider } diff --git a/types/test/index.ts b/types/test/index.ts index 3559712..e93e939 100644 --- a/types/test/index.ts +++ b/types/test/index.ts @@ -4,7 +4,7 @@ import 'isomorphic-fetch' import { ApolloClient } from 'apollo-client' import { HttpLink } from 'apollo-link-http' -import VueApollo, { ApolloProvider } from '../index' +import VueApollo from '../index' import App from './App' const httpLink = new HttpLink({ uri: 'https://dummy.test.com' }) @@ -27,16 +27,3 @@ Vue.use(VueApollo) /* eslint no-new: 0 */ new Vue({ el: '#app', provide: apolloProvider.provide(), render: h => h(App) }) - -const provider: ApolloProvider = apolloProvider -const component = new Vue() - -/* eslint no-unused-expressions: 0, no-return-await: 0 */ -async () => await provider.prefetchAll({ context: 'context' }, [component]) -async () => await provider.prefetchAll({ context: 'context' }, [component], { includeGlobal: false }) - -for (const key in provider.getStates()) { console.log(key) } -for (const key in provider.getStates({ exportNamespace: 'nameSpace' })) { console.log(key) } - -provider.exportStates().match(/js/) -provider.exportStates({ globalName: '__APOLLO_STATE__', attachTo: 'window', exportNamespace: '' }).match(/js/) diff --git a/types/test/willPrefetch.ts b/types/test/willPrefetch.ts deleted file mode 100644 index ba3fb8f..0000000 --- a/types/test/willPrefetch.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { willPrefetch } from '../index' -import gql from 'graphql-tag' - -export default willPrefetch({ - apollo: { - allPosts: { - query: gql`query AllPosts { - allPosts { - id - imageUrl - description - } - }`, - prefetch: true, // Don't forget this - } - } -}) \ No newline at end of file diff --git a/types/vue.d.ts b/types/vue.d.ts index 5bb554d..65ba0d4 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -1,14 +1,16 @@ -import Vue from "vue"; -import { DollarApollo } from './vue-apollo'; +import Vue from 'vue' +import { DollarApollo } from './vue-apollo' import { VueApolloComponentOption } from './options' +import { ApolloProvider } from './apollo-provider'; -declare module "vue/types/options" { +declare module 'vue/types/options' { interface ComponentOptions { - apolloProvider?: VueApolloComponentOption; + apolloProvider?: ApolloProvider + apollo?: VueApolloComponentOption } } -declare module "vue/types/vue" { +declare module 'vue/types/vue' { interface Vue { $apollo: DollarApollo; }