nathanreyes / v-calendar

An elegant calendar and datepicker plugin for Vue.
https://vcalendar.io
MIT License
4.41k stars 863 forks source link

Module 'v-calendar' should export types from utils package #1472

Open AdrienLeblanc opened 6 months ago

AdrienLeblanc commented 6 months ago

Hello !

Context :

We are currently using v-calendar 3.1.2 and are facing a problem with some types not being properly exported by 'v-calendar' module. Our Vue project is built with Vite and it seems that Vite is not capable of resolving an import at the start.

image

In fact, we import { AttributeConfig } from 'v-calendar/dist/types/src/utils/attribute' for typing purposes to make the code clearer, sadly it is currently not exported by the 'v-calendar' module in the beginning. I tried to configure my project to bypass this warning, in vain.

Proposed solution:

Is it possible to add the different types to the exports of the module ? So we can use proper typing on our side. AttributeConfig is not the only one, the goal would be to export the maximum of types developers might use in the future also.

Thanks !

cojohnson1999 commented 6 months ago

I'm facing the same problem with V-Calendar version 3.1.2 with types exported from v-calendar/dist/types/src/utils/date/helpers. When importing the DateParts interface for typing purposes, I get the following Vite build error:

error TS2307: Cannot find module 'v-calendar/dist/types/src/utils/date/helpers' or its corresponding type declarations.

import { DateParts } from 'v-calendar/dist/types/src/utils/date/helpers';

Having these types be exported properly would be great.

vasilistotskas commented 2 days ago

I have the same issue in nuxt3.14 :

Tried both ways:

import type { DatePickerDate, DatePickerRangeObject } from 'v-calendar/src/use/datePicker'
import type { DatePickerDate, DatePickerRangeObject } from 'v-calendar/dist/types/src/use/datePicker'

Getting warning: Vue: Cannot find module v-calendar/ src/ use/ datePicker or its corresponding type declarations. Vue: Cannot find module v-calendar/ dist/ types/ src/ use/ datePicker or its corresponding type declarations.