what's the type of the Vue.Draggable "change" event?

207 views Asked by At

I'm trying to get the type (in a typescript sense) of a change event from Vue.Draggable https://github.com/SortableJS/Vue.Draggable

but can't find its definition

the documentation shows that the event is not a browser event and has a specific payload https://github.com/SortableJS/Vue.Draggable#events

an example can be seen here : https://github.com/SortableJS/Vue.Draggable/issues/338#issuecomment-361723458

I dont see it in their definition file https://github.com/SortableJS/Vue.Draggable/blob/master/src/vuedraggable.d.ts

I'm far from a pro in typescript, am I missing something ? is there another place to check ?

2

There are 2 answers

0
Mathieu On BEST ANSWER

I've submitted a feature request to get that typing added

https://github.com/SortableJS/Vue.Draggable/issues/1229

(they recommend to post here before submitting an issue)

1
ExEr7um On

Vue.Draggable is based on Sortable.js, so you actually need types from that library. You can install @types/sortablejs and import type that you need.

You can check out types yourself, but as I understand you need type from onChange event.

onChange event type

You can import it by using:

import type { SortableEvent } from "sortablejs"