defineGeneric
Stability:
stable
Declare single generic one by one using DefineGeneric
.
Especially useful for
setup-sfc
.
Features | Supported |
---|---|
Volar Plugin | ✅ |
Basic Usage
vue
<script setup lang="ts"> defineOptions({ name: 'App', }) type T = DefineGeneric<number> defineProps<{ foo: T }>() </script> <template> <App foo="1" /></template>
Volar Configuration
jsonc
{ "vueCompilerOptions": { "plugins": ["unplugin-vue-macros/volar"], }, }