So I’ve been working on an open source calendar for Vue 3 for a while now. I’m using TypeScript in the project, and Vite library mode for bundling the code into a single importable component. I now have the issue, that when using the calendar in another TypeScript project, the component types are not recognized. Whenever I therefore use a slot, my IDE also rightfully tells me that the type of
does not exist on the component. In my package.json, I’m setting
types to point to the index.ts of this directory: qalendar/src at tomosterlund-test-index-ts · tomosterlund/qalendar · GitHub
Since I’m not so experienced with decalaration files, I tried to follow the example of vueform/multiselect: multiselect/src at main · vueform/multiselect · GitHub
- Refer to types in index.ts, in package.json
- Import/export component in index.ts
- Write declaration file named Multiselect.d.ts in the same directory where the component is being exported.
In vueform/multiselect, this works excellent. I get all the types and auto-completion thereof, whenever I use that multiselect and start typing props or slots. For my own calendar component, it does not work. Does anyone recognize the problem?