<h2 align="center">vite-plugin-vue-type-imports</h2>
Enables you to import types and use them in your defineProps and defineEmits. Supports both Vue 2 and Vue 3.
> ⚠️ This Plugin is still in Development and there may be bugs. Use at your own risk.
bash
Install Plugin
npm i -D vite-plugin-vue-type-imports
``ts
// vite.config.tsimport { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import VueTypeImports from 'vite-plugin-vue-type-imports'
export default defineConfig({
plugins: [
Vue(),
VueTypeImports(),
],
})
`$3
`ts
// nuxt.config.tsexport default {
buildModules: [
'vite-plugin-vue-type-imports/nuxt',
]
}
`Usage
`ts
// types.tsexport interface User {
username: string
password: string
avatar?: string
}
``html
...
`Known limitations
- Namespace imports like import * as Foo from 'foo' are not supported.
- These types are not supported.
- The plugin currently only scans the content of