- withDefaults<T, BKeys, Defaults>(props, defaults): PropsWithDefaults<T, Defaults, BKeys>
Type Parameters
T
BKeys extends string | number | symbol
Defaults extends InferDefaults<T>
Parameters
props: DefineProps<T, BKeys>
defaults: Defaults
Returns PropsWithDefaults<T, Defaults, BKeys>
Vue
<script setup>
compiler macro for providing props default values when using type-baseddefineProps
declaration.Example usage:
This is only usable inside
<script setup>
, is compiled away in the output and should not be actually called at runtime.