You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I dont know if this is a bug or a feature request.
Describe the bug
Currently there seems to be no way to set up the ref for the Carousel component in a typesafe way.
To have editors add typings and intellisense to the ref we would need to add a type to it.
As far as I know, there is no type to add to the ref to get the correct typings as const carousel = ref<CarouselElement>(null);
To Reproduce
Steps to reproduce the behavior:
Add the <Carousel> to a components template part
Add a ref to the carousel component: <Carousel ref="carousel">
Add the ref to the script setup part: const carousel = ref(null)
Try to access any of the carousels properties/functions in script-setup. Typing of the ref is (property) Ref<null>.value: null
Also in template the functions typings say Property 'prev' does not exist on type 'never'.
What I tried to get around this:
importtype{Carousel}from'vue3-carousel';constcarousel=ref<Carousel>();// --------// --> 'Carousel' refers to a value, but is being used as a type here. Did you mean 'typeof Carousel'?
importtype{Carousel}from'vue3-carousel';constcarousel=ref<typeofCarousel>();constcurSlide=computed(()=>carousel.value?.data?.currentSlide??0);// ------------// --> Property 'currentSlide' does not exist on type '(this: CreateComponentPublicInstance<...>, vm: CreateComponentPublicInstance<Readonly<ExtractPropTypes<{ itemsToShow: { default: number; type: NumberConstructor; }; itemsToScroll: { default: number; type: NumberConstructor; }; wrapAround: { default: boolean | undefined; type: BooleanConstructor; }; ... 11 more ...; ...'.
Additional Info
I am trying to use this in a nuxt@3 environment with the "vue3-carousel-nuxt" wrapper
Expected behavior
vue3-carousel exports a typeing to be used with refs to be typesafe.
The text was updated successfully, but these errors were encountered:
Since this library doesn't come with correct typings – missing component's exposed instance properties – you have to define it yourself. I'm using this
I dont know if this is a bug or a feature request.
Describe the bug
Currently there seems to be no way to set up the ref for the Carousel component in a typesafe way.
To have editors add typings and intellisense to the ref we would need to add a type to it.
As far as I know, there is no type to add to the ref to get the correct typings as
const carousel = ref<CarouselElement>(null);
To Reproduce
Steps to reproduce the behavior:
<Carousel>
to a components template part<Carousel ref="carousel">
const carousel = ref(null)
(property) Ref<null>.value: null
Property 'prev' does not exist on type 'never'.
What I tried to get around this:
Additional Info
I am trying to use this in a nuxt@3 environment with the "vue3-carousel-nuxt" wrapper
Expected behavior
vue3-carousel exports a typeing to be used with refs to be typesafe.
The text was updated successfully, but these errors were encountered: