Closed kirbby closed 2 months ago
Until the types are fixed you can temporarily sort this by passing a type parameter: app.use<[]>(Vue3TouchEvents);
Thanks, works like a charm!
When you want to set some options and also need typing support, you can also use the following:
import Vue3TouchEvents, {
type Vue3TouchEventsOptions,
} from "vue3-touch-events";
app.use<Vue3TouchEventsOptions>(Vue3TouchEvents, {
disableClick: true,
touchHoldTolerance: 500,
})
@stefan-hoelzl is this correct? https://github.com/robinrodricks/vue3-touch-events?tab=readme-ov-file#typescript-vue-34
@stefan-hoelzl is this correct? https://github.com/robinrodricks/vue3-touch-events?tab=readme-ov-file#typescript-vue-34
yes, this is how it is working for me! Thanks!
This works, thanks!
I wanna emphasize though, that you need to specify an options object, even if you are not passing any options to it, otherwise you still get a Typescript error.
Not working:
app.use<Vue3TouchEventsOptions>(Vue3TouchEvents)
Working:
app.use<Vue3TouchEventsOptions>(Vue3TouchEvents, {})
Maybe worth noting in the read.me @robinrodricks
Other than that this is resolved and I will close.
With Vue 3.4.0 and higher there is a type issue for the plugin in the
main.ts
.Argument of type '[]' is not assignable to parameter of type 'never'.ts(2345)
atapp.use(Vue3TouchEvents);
I just tried to find a fix for a while, but I'm neither a TS wizard nor do I have any experience with creating Vue plugins, so help is appreciated.