You can currently get .d.ts files by either:
- Manually invoking
vue-tsc
- Using vite-plugin-dts, which unfortunately doesn't use the same transformation/way to extract types the Vue language services does, and as such has compatibility issues (Many remain unresolved ATM as the other is unresponsive).
- Using vite-dts which requires shipping sources and is also unmaintained and doesn't work with newer Vite versions.
This is not ideal, it would be nice to have an official way to generate .d.ts files for Vite built libraries. It's kind of an essential part for any TypeScript built component library.
It would be cool to have an official plugin to generate types during build time based on the Vue language tools. The standard way in Rollup is using rollup-plugin-typescript2 but that doesn't know about Vue. So one way would be to extend it to support Vue. Otherwise any approach which works as a plugin to Vite and works well in build --watch mode will be very very helpful.
Due to not having a proper solution for this we are currently stuck on Vue 3.2 and cannot upgrade to Vue 3.3. qmhc/unplugin-dts#220
You can currently get .d.ts files by either:
vue-tscThis is not ideal, it would be nice to have an official way to generate
.d.tsfiles for Vite built libraries. It's kind of an essential part for any TypeScript built component library.It would be cool to have an official plugin to generate types during build time based on the Vue language tools. The standard way in Rollup is using
rollup-plugin-typescript2but that doesn't know about Vue. So one way would be to extend it to support Vue. Otherwise any approach which works as a plugin to Vite and works well inbuild --watchmode will be very very helpful.Due to not having a proper solution for this we are currently stuck on Vue 3.2 and cannot upgrade to Vue 3.3. qmhc/unplugin-dts#220