How to use `VueI18n` with typescript and `vue2.0`? `new VueI18n({..})` report `has no construct signatures` error

Viewed 1028

I followed the installation guide but getting error at Vue.use(VueI18n); and const i18n = new VueI18n({...});.

Vue.use(VueI18n) reports

No overload matches this call.
  Overload 1 of 2, '(plugin: PluginObject<unknown> | PluginFunction<unknown>, options?: unknown): VueConstructor<Vue>', gave the following error.
    Argument of type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' is not assignable to parameter of type 'PluginObject<unknown> | PluginFunction<unknown>'.
      Property 'install' is missing in type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' but required in type 'PluginObject<unknown>'.
  Overload 2 of 2, '(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<Vue>', gave the following error.
    Argument of type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' is not assignable to parameter of type 'PluginObject<any> | PluginFunction<any>'.
      Property 'install' is missing in type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' but required in type 'PluginObject<any>'.
    12 | import VueI18n from "vue-i18n";
    13 | 
  > 14 | Vue.use(VueI18n);

and const i18n = new VueI18n({...}); reports

This expression is not constructable.
  Type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' has no construct signatures.

Here is my Vue instance.

new Vue({
  vuetify,
  router,
  i18n,
  render: (h) => h(App),
}).$mount("#app");
0 Answers
Related