Hello 🖖
Sample
<template>
<div>
<slot name="child" />
</div>
</template>
<script lang="ts" setup generic="T">
</script>
ComponentSlots<typeof Sample> always return {}.
Generics
For generic components (<script setup lang="ts" generic="...">) Vue processor generate a FunctionalComponent.
And ComponentSlots<typeof MyGenericComponent> always returns {}.
Fix
The original implementation of ComponentSlots is
export type ComponentSlots<T> =
T extends new () => { $slots: infer S; } ? NonNullable<S> :
T extends (props: any, ctx: { slots: infer S; }, ...args: any) => any ? NonNullable<S> :
{};
If I change by adding attrs & emit fields in context:
export type ComponentSlots<T> =
T extends new () => { $slots: infer S } ? NonNullable<S> :
T extends (props: any, ctx: { slots: infer S; attrs: any; emit: any }, ...args: any) => any ? NonNullable<S> :
{}
it works
ComponentEmit
Probably same error with ComponentEmit.