• Vue <script setup> compiler macro for declaring component props. The expected argument is the same as the component props option.

    Example runtime declaration:

    // using Array syntax
    const props = defineProps(['foo', 'bar'])
    // using Object syntax
    const props = defineProps({
    foo: String,
    bar: {
    type: Number,
    required: true

    Equivalent type-based declaration:

    // will be compiled into equivalent runtime declarations
    const props = defineProps<{
    foo?: string
    bar: number

    Type Parameters

    • PropNames extends string = string


    • props: PropNames[]

    Returns Prettify<Readonly<{
        [key in PropNames]?: any



    This is only usable inside <script setup>, is compiled away in the output and should not be actually called at runtime.

  • Type Parameters


    • props: PP

    Returns Prettify<Readonly<ExtractPropTypes<PP>>>

  • Type Parameters

    • TypeProps

    Returns DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>

Generated using TypeDoc