Generic types + dynamic slot names #8725
Unanswered
mzgajner
asked this question in
Help/Questions
Replies: 1 comment 1 reply
-
This will help
|
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Playground with minimal reproduction
We're trying to make use of generic components introduced in Vue 3.3. We have a
Table
component that accepts a list of objects:It renders each item in the list as a table row with each property of item as a cell in that row. We're dynamically generating named slots for each cell:
This allows the component consuming
Table
to customize how columns are rendered:The issue we're having is that the inferred type of
value
in the last example isstring | number
, which is a union of types of all properties in the passed item(s).Is there anything we could change so that it is automatically resolved to
number
based on type ofrow['age']
?Beta Was this translation helpful? Give feedback.
All reactions