Implicit generic type on slot children #13846
Unanswered
spladug
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have a parent/child pair of generic components (
DataTable<T>
andDataTableColumn<T>
) where I want to tie the type parameter together implicitly when the child is used in a slot, like so:where DataTable looks like:
and DataTableColumn is:
I want the type of
row
to be inferred from the type of:data
so I can get proper typechecking in templates for usage of the row type.I saw #8015 and it seems like a similar use case, but the best I figured out was to put
<!-- @vue-generic {MyArrayElementType} -->
before each DataTableColumn definition which is pretty unfortunate. I've also tried changing thedefineSlots()
definition to have return types other thanany
to no success.I'm using Vue 3.5.13 and vue-tsc 2.2.2.
Is there a way to infer the type through automatically?
Beta Was this translation helpful? Give feedback.
All reactions