Vue.Draggable: TypeScript: Added types in 2.24.0 causing issues
Since release v2.24.0, vuedraggable
includes typing information for the package. While this is generally super useful to have included out of the box, it’s causing a bit of a problem for me currently:
I’m getting an error from TypeScript originating in vuedraggable
when trying to compile my app after updating to v2.24.0
:
ERROR in /Users/rijk/[redacted]/node_modules/vuedraggable/src/vuedraggable.d.ts(8,5):
8:5 Property 'element' in type 'Draggable' is not assignable to the same property in base type 'object & Record<never, any> & Vue'.
Type 'string' is not assignable to type 'Element | null'.
6 | noTransitionOnDrag: boolean;
7 |
> 8 | element: string;
| ^
9 |
10 | tag: string;
11 |
Next to this, TypeScript keeps complaining that the Draggable class can’t be used in components
as Draggable
can’t be assigned to VueConstructor<Vue>
*:
No overload matches this call.
Overload 3 of 3, '(options: ComponentOptionsWithProps<{ collection: { type: StringConstructor; required: true; }; }, Data, Data, {}, {}, { collection: string; } & {}>): VueProxy<...>', gave the following error.
Type 'typeof Draggable' is not assignable to type 'VueConstructor<Vue> | FunctionalComponentOptions<any, PropsDefinition<any>> | ComponentOptions<never, any, any, any, any, Record<...>> | AsyncComponentPromise<...> | AsyncComponentFactory<...>'.
Type 'typeof Draggable' is not assignable to type 'VueConstructor<Vue>'.
* This is when using @vue/composition-api
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 18 (8 by maintainers)
@Keimeno This one doesn’t cause any issues on my end 🙂 🎉
@Keimeno PR merged and release updated: check version 2.24.1
Very quick/astute, and yes, accurate observation. Apologies - thought I scanned for this but looks like I didn’t catch it.