DefineGeneric
Stability:
experimental
⚠️ Experimental feature, use at your riskDeclare 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
// tsconfig.json
{
"vueCompilerOptions": {
"plugins": [
"@vue-macros/volar/define-generic",
// ...more feature
],
},
}