Type Alias ComponentSlots<T>

ComponentSlots<T>: T extends (new (...args: any) => {
        $slots: infer S;
    })
    ? NonNullable<S>
    : T extends ((props: any, ctx: {
            attrs: any;
            emit: any;
            slots: infer S;
        }, ...args: any) => any)
        ? NonNullable<S>
        : {}

获取组件插槽

import HelloWorld from './HelloWorld.vue'
type Slots = ComponentSlots<typeof HelloWorld>

Type Parameters

  • T