Open
Description
Vue version
3.5.13
Link to minimal reproduction
Steps to reproduce
Open the reproduction and have a look at the type of the val
slot data property in both components.
interface Props<T> {
val: T
}
interface Slots<T> {
default: { val: T }
}
const AnyExample = defineComponent(
// I would expect this component to use the `SlotsType` from the `SetupContext` parameter
<T extends string>(props: Props<T>, ctx: SetupContext<{}, SlotsType<Slots<T>>>) => {
return () => h('div', [
ctx.slots.default?.({ val: props.val })
])
},
{
props: ['val']
}
)
<template>
<!-- The `val` property here is `any`, though I would expect it to be the same type as the `val` prop => `'else'` -->
<AnyExample val="else" v-slot="{ val }">
{{ val }}
</AnyExample>
</template>
What is expected?
When defining a component using defineComponent()
with the new function signature, I would expect to be able to pass the generic types into the slots type.
defineComponent(
<T extends string>(props: Props<T>, ctx: SetupContext<{}, SlotsType<Slots<T>>>) => {
What is actually happening?
The type of the generic properties in the slots is any
, instead of the correct generic type.
System Info
Any additional comments?
No response