Vuepic / vue-datepicker

Datepicker component for Vue 3
https://vue3datepicker.com
MIT License
1.46k stars 146 forks source link

Bug: clear-icon slotProps has type error #842

Closed mikinovation closed 5 months ago

mikinovation commented 5 months ago

Describe the bug

app.vue:10:28 - error TS2493: Tuple type '[]' of length '0' has no element at index '0'.

10     <template #clear-icon="{ clear }">
                              ~~~~~~~~~

app.vue:10:30 - error TS2339: Property 'clear' does not exist on type 'undefined'.

10     <template #clear-icon="{ clear }">
                                ~~~~~

To Reproduce

This is the minimalized project.

https://github.com/mikinovation/sandbox/tree/main/vue/nuxt-vuedatepicker

You can check type error

pnpm install
pnpm typecheck

Expected behavior

the props should have "clear" function

mikinovation commented 5 months ago

I tried to fix this problem and added this code to DatepickerInput.vue However it doesn't work.

defineSlots<{
        trigger: any;
        ['dp-input'](): any;
        ['clear-icon'](props: { clear: (ev?: Event) => void }): any;
        ['input-icon'](): any;
    }>();