- defineProps<PropNames>(props): Prettify<Readonly<{
[key in PropNames]?: any
}>> Type Parameters
- PropNames extends string = string
Returns Prettify<Readonly<{
[key in PropNames]?: any
}>>
- defineProps<PP>(props): Prettify<Readonly<ExtractPropTypes<PP>>>
- defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>
Vue
<script setup>
compiler macro for declaring component props. The expected argument is the same as the componentprops
option.Example runtime declaration:
Equivalent type-based declaration: