-
I have a Pinia store that has an array like: breadcrumbs: [] as Array<CrumbNaviItem | DynamicCrumbNaviItem>, When I iterate this in a Vue template (using SFC and script setup), I'm narrowing the type by checking if the list item has a renderer attribute that the other type doesn't have:
The code itself works fine but Volar gives me this TS error:
Is this a Volar issue or can I do something to help it to narrow the type here? |
Beta Was this translation helpful? Give feedback.
Answered by
Uninen
Apr 17, 2022
Replies: 2 comments
-
Try this
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Cool! Thanks, this indeed works! (Other way around, tho.) 👍 <BreadcrumbsNavItem v-if="'render' in item" :item="item" /> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Uninen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool! Thanks, this indeed works! (Other way around, tho.) 👍