anish2690 / vue-draggable-next

Vue 3 drag-and-drop component
https://vue-draggable-next.vercel.app
MIT License
508 stars 45 forks source link

when use it in typescript ,it cannot be recognized correctly #3

Closed bigmeow closed 3 years ago

bigmeow commented 4 years ago

image

My temporary solution is:

// shims-vue.d.ts
declare module "*.vue" {
    import { defineComponent } from "vue";
    const component: ReturnType<typeof defineComponent>;
    export default component;
}
// add
declare module "vue-draggable-next" {
    export { VueDraggableNext } from "vue-draggable-next/dist/src/index";
}
joel785454405 commented 4 years ago

Just write like this👇

declare module 'vue-draggable-next';

joel785454405 commented 4 years ago

image

My temporary solution is:

// shims-vue.d.ts
declare module "*.vue" {
    import { defineComponent } from "vue";
    const component: ReturnType<typeof defineComponent>;
    export default component;
}
// add
declare module "vue-draggable-next" {
    export { VueDraggableNext } from "vue-draggable-next/dist/src/index";
}

reply 👀

anish2690 commented 4 years ago

@bigmeow is something I have it on my plan for timing just use declare module 'vue-draggable-next'

MaybeQHL commented 4 years ago

@anish2690 I think it should be specified in the types field of package.json to avoid error reporting.

bigmeow commented 4 years ago

I want it to be recognized automatically instead of writing any code

anish2690 commented 3 years ago

https://github.com/anish2690/vue-draggable-next/pull/4 added support for type definition