Open
Description
Vue version
3.4.27
Link to minimal reproduction
Steps to reproduce
In the official use case, when defining components using defineComponent
, an example of using generics is as follows:
const Comp = defineComponent(
<T extends string | number>(props: { msg: T; list: T[] }) => {
// use Composition API here like in <script setup>
const count = ref(0)
return () => {
// render function or JSX
return <div>{count.value}</div>
}
},
// manual runtime props declaration is currently still needed.
{
props: ['msg', 'list']
}
)
I know that generic
can be used to define in composite APIs, but child components and parent components are defined by defineComponent, so I want to know how to pass generic from the parent component in tsx###
What is expected?
like react, we can pass generics like this:
return () => {
return (
<div>
<Comp<{ name: string }> msg="hello" list={list.value} />
</div>)
}
What is actually happening?
I couldn't find any way to pass generics into child components,like this
System Info
No response
Any additional comments?
No response