robinrodricks / vue3-touch-events

Simple touch events support for vue.js 3
MIT License
216 stars 27 forks source link

Module '"vue"' has no exported member 'PluginObject' #2

Closed saibbyweb closed 8 months ago

saibbyweb commented 3 years ago

I am using Vue3 + Typescript (Vite), initialising the plugin in main.ts like this:

import { createApp } from 'vue'
import App from "./App.vue"
import Vue3TouchEvents from "vue3-touch-events";
const app = createApp(App);
app.use(Vue3TouchEvents);
app.mount('#app');

Everything works fine in dev, but my builds are failing. I'm getting:

node_modules/vue3-touch-events/index.d.ts:1:9 - error TS2305: 
Module '"vue"' has no exported member 'PluginObject'.

1 import {PluginObject} from "vue";
          ~~~~~~~~~~~~

Temporarily, I'm able to fix this by adding a file at src/types/vue3-touch-events.d.ts with the following contents:

import Vue from "vue";
declare module "vue" {
  export type PluginObject<T> = (app: Vue.App, ...options: any[]) => any;
}

Hope it helps.

robinrodricks commented 3 years ago

Great thanks. If I make this change in the npm module will it still work?

On Mon, May 10, 2021, 10:29 PM saibbyweb @.***> wrote:

I am using Vue3 + Typescript (Vite), initialising the plugin in main.ts like this:

import { createApp } from 'vue' import App from "./App.vue" import Vue3TouchEvents from "vue3-touch-events"; const app = createApp(App); app.use(Vue3TouchEvents); app.mount('#app');

Everything works fine in dev, but my builds are failing. I'm getting:

node_modules/vue3-touch-events/index.d.ts:1:9 - error TS2305: Module '"vue"' has no exported member 'PluginObject'.

1 import {PluginObject} from "vue";



Temporarily, I'm able to fix this by adding a file at
src/types/vue3-touch-events.d.ts with the following contents:

import Vue from "vue";
declare module "vue" {
  export type PluginObject<T> = (app: Vue.App, ...options: any[]) => any;
}

Hope it helps.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/robinrodricks/vue3-touch-events/issues/2>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABT3UKUZ425LCYBHUE3YRITTNAGFRANCNFSM44RWFJZA>
.
saibbyweb commented 3 years ago

That you'll have to test yourself. Best of luck.

sriharsha-samana commented 2 years ago

I have the same problem :|

alecgibson commented 10 months ago

I've raised https://github.com/robinrodricks/vue3-touch-events/pull/28 to fix this.

In the meantime, the more "accurate" workaround is:

declare module "vue" {
  export {Plugin as PluginObject} from 'vue';
}