It would be great if you could add types of using this plugin in typescript project. Otherwise could you tell how to write custom types for bypass type checks?
I tried adding this to a type definition file but it didn't work -
/**
* Augment the typings of Vue.js
*/
declare module 'vue/types/vue' {
import Vue from 'vue';
export interface Vue {
$apollo: any;
}
}
declare module 'vue/types/options' {
import Vue from 'vue';
export interface ComponentOptions<V extends Vue> {
apollo?: any;
}
}
View itself has typescript definitions but vue-apollo, no.
So here's a stating point for vue-apollo :
declare module "vue-apollo" {
import { ApolloClient } from 'apollo-client';
import Vue, { PluginObject } from 'vue';
export const addGraphQLSubscriptions: {};
class VueApollo implements PluginObject<{}> {
[key: string]: any;
install: PluginFunction<{}>;
constructor (options: {defaultClient: ApolloClient});
static install(pVue: typeof Vue, options?:{} | undefined): void;
}
export default VueApollo;
}
For your question, you're right, here it is :
import Vue from 'vue';
declare module "vue/types/vue" {
interface Vue {
$apollo: any;
}
}
declare module 'vue/types/options' {
interface ComponentOptions<V extends Vue> {
apollo?: any;
}
}
Hi,
The proposed solution by @stphdenis doesn't work for me.
Has someone figured it out?
Most helpful comment
For your question, you're right, here it is :