slots has error type when it's defined by defineSlots with generic.
Vue version
3.3.4
Link to minimal reproduction
Steps to reproduce
<template>
{{ slots.footer }}
<!-- but type of <slot name="footer" :id="1"></slot> can work. -->
</template>
<script lang="ts" setup generic="T extends string">
defineProps<{ slotNames: T }>()
const slots = defineSlots<Record<T, () => any> & { footer(props: { id: number }): any}>();
</script>
What is expected?
Property 'footer' should be in slots in template.
What is actually happening?
Property 'footer' does not exist on type 'Readonly<NonNullable<Record<T, () => any> & { footer(props: { id: number; }): any; }>> extends Ref
System Info
No response
Any additional comments?
No response
const slots = defineSlots<Record<T, () => any> & { footer(props: { id: number }): any}>();
doesn't work
but
const slots = defineSlots<{ footer(props: { id: number }): any} & Record<T, () => any>>();
works.
I guess this might be related to https://github.com/microsoft/TypeScript/issues/51092
Blocked by https://github.com/vuejs/language-tools/issues/3651, I opened https://github.com/vuejs/language-tools/pull/3671 to fix this issue temporarily