• Vue <script setup> compiler macro for declaring a component's emitted events. The expected argument is the same as the component emits option.

    Example runtime declaration:

    const emit = defineEmits(['change', 'update'])

    Example type-based declaration:

    const emit = defineEmits<{
    // <eventName>: <expected arguments>
    change: []
    update: [value: string] // named tuple syntax

    emit('update', 1)

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

    Type Parameters

    • EE extends string = string


    • emitOptions: EE[]

    Returns EmitFn<EE[]>

  • Type Parameters


    • emitOptions: E

    Returns EmitFn<E>

  • Type Parameters

    • T extends Record<string, any[]> | ((...args) => any)

    Returns T extends ((...args) => any)
        ? T
        : ShortEmits<T>

Generated using TypeDoc