Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slot input typings and error #1497

Open
iBobik opened this issue Sep 4, 2024 · 0 comments
Open

Slot input typings and error #1497

iBobik opened this issue Sep 4, 2024 · 0 comments

Comments

@iBobik
Copy link

iBobik commented Sep 4, 2024

I use it like this:

<DatePicker v-model="date" mode="date" :masks="{ input: 'D. MMMM YYYY' }" :min-date="new Date()" :max-date="new Date().setFullYear(new Date().getFullYear() + 1)">
        <template #default="{ inputValue, inputEvents }">
          <UInput ref="dateInputRef" :value="inputValue" v-on="inputEvents" icon="i-heroicons-calendar" />
        </template>
      </DatePicker>

But Typescript complains:

'inputValue' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)

Also on value update is prints this messages to the console, but works.

runtime-core.esm-bundler.js?v=86a7d487:50 [Vue warn]: Unhandled error during execution of native event handler 
  at <CalendarSlot name="day-content" day= Object attributes= Array(1)  ... > 
  at <Anonymous key="2024-09-10" day= Object > 
  at <CalendarPage> 
  at <CalendarSlot name="page" page= Object > 
  at <CalendarPageProvider key="2024-09" page= Object > 
  at <BaseTransition onBeforeEnter=fn<onBeforeEnter> onAfterEnter=fn<onTransitionAfterEnter> appear=false  ... > 
  at <Transition name="vc-fade" onBeforeEnter=fn<onTransitionBeforeEnter> onAfterEnter=fn<onTransitionAfterEnter> > 
  at <Anonymous key=1 attributes= Array(1) ref_key="calendarRef"  ... > 
  at <DatePickerBase > 
  at <BaseTransition onBeforeEnter=fn<onBeforeEnter> onAfterEnter=fn<afterEnter> onBeforeLeave=fn<beforeLeave>  ... > 
  at <Transition name="vc-slide-fade" appear="" onBeforeEnter=fn<beforeEnter>  ... > 
  at <Anonymous id= Symbol() placement="bottom-start" class="vc-date-picker-content vc-blue vc-light"  ... > 
  at <DatePickerPopover > 
  at <Anonymous modelValue= Tue Sep 10 2024 20:30:47 GMT+0200 (středoevropský letní čas) onUpdate:modelValue=fn > 
  at <App key=4 > 
  at <NuxtRoot>
warn$1 @ runtime-core.esm-bundler.js?v=86a7d487:50
Show 1 more frame
Show less
runtime-core.esm-bundler.js?v=86a7d487:266 Uncaught TypeError: Cannot read properties of undefined (reading 'dayIndex')
    at DateRangeContext.render (v-calendar.js?v=0ce91fcd:4738:35)
    at v-calendar.js?v=0ce91fcd:6965:13
    at Array.forEach (<anonymous>)
    at v-calendar.js?v=0ce91fcd:6964:19
    at Array.forEach (<anonymous>)
    at ComputedRefImpl.fn (v-calendar.js?v=0ce91fcd:6963:22)
    at refreshComputed (reactivity.esm-bundler.js?v=86a7d487:330:29)
    at isDirty (reactivity.esm-bundler.js?v=86a7d487:297:67)
    at refreshComputed (reactivity.esm-bundler.js?v=86a7d487:320:47)
    at isDirty (reactivity.esm-bundler.js?v=86a7d487:297:67)

Version: 3.1.2

Repro: https://stackblitz.com/edit/github-ocjroj?file=app.vue

Is there something better to do than suppressing the error?

@iBobik iBobik changed the title Fix typings for slots Slot input typings and error Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant