-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NavigationMenu/DropdownMenu/ContextMenu] Generic type doesn't work when passing links as [][]
#2140
Comments
[][]
[][]
Hello @benjamincanac , I'd like to help you with this issue, can I ask you for additional details? I'm not sure I got what the bug is / what I need to fix exactly, is it only related to links given as items, for example something like this? // ...
const items = [
[{ link: '/link/to/somewhere', label: 'Some Text' }]
]
</script>
<template>
<NavigationMenu :items="items" />
// .... |
The issue is when passing
We can see in the second example that the inferred type for <script setup lang="ts">
const items = [[{
label: 'Item',
myfield: 'myfield'
}]]
</script>
<template>
<UNavigationMenu :items="items">
<template #item="{ item }">
{{ item.myfield }}
</template>
</UNavigationMenu>
</template> I have no idea how to fix that at the moment so any help is appreciated. Let me know if you need additional informations 😊 |
@yassilah Given the awesome work you did on generic types, would you have an idea on how to solve this as well? |
Here's how I would do it (it works but there were already type errors in the file so I left it as it): |
I can also make a PR for this one and add type tests. I would wait for #2471 to be merged and re-use the |
[][]
[][]
No description provided.
The text was updated successfully, but these errors were encountered: