defineProps
Stability:
stable
Correct types of destructured props using $defineProps
.
See also Vue issue, Reactivity Transform RFC.
Features | Supported |
---|---|
Vue 3 | ✅ |
Nuxt 3 | ✅ |
Vue 2 | ✅ |
TypeScript / Volar Plugin | ✅ |
WARNING
Reactivity Transform is required. You should enable it first.
Basic Usage
vue
<script setup lang="ts">
const { foo } = $defineProps<{
foo: string[]
}>()
const fooRef = $$(foo)
</script>
Volar Configuration
jsonc
{
"vueCompilerOptions": {
"plugins": ["unplugin-vue-macros/volar"],
},
}