vite-plugin-vue-type-imports
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.3 • Public • Published

    vite-plugin-vue-type-imports

    Enables you to import types and use them in your defineProps and defineEmits

    NPM version

    ⚠️ This Plugin is still in Development and there may be bugs. Use at your own risk.

    Install

    # Install Plugin
    npm i -D vite-plugin-vue-type-imports
    // vite.config.ts
    
    import { defineConfig } from 'vite'
    import Vue from '@vitejs/plugin-vue'
    import VueTypeImports from 'vite-plugin-vue-type-imports'
    
    export default defineConfig({
      plugins: [
        Vue(), 
        VueTypeImports(),
      ],
    })

    Nuxt

    // nuxt.config.ts
    
    export default {
      buildModules: [
        'vite-plugin-vue-type-imports/nuxt',
      ]
    }

    Usage

    // types.ts
    
    export interface User {
      username: string
      password: string
      avatar?: string
    }
    <script setup lang="ts">
    import type { User } from '~/types'
    
    defineProps<User>()
    </script>
    
    <template>...</template>

    License

    MIT License © 2021-PRESENT Jacob Clevenger

    Keywords

    none

    Install

    npm i vite-plugin-vue-type-imports

    DownloadsWeekly Downloads

    176

    Version

    0.1.3

    License

    MIT

    Unpacked Size

    5.52 MB

    Total Files

    11

    Last publish

    Collaborators

    • wheatley