From fc2015bb0e9ccb017a91ba1ee839cd84cf740cf3 Mon Sep 17 00:00:00 2001 From: Yasser Lahbibi Date: Tue, 29 Oct 2024 19:21:35 +0100 Subject: [PATCH] fix(NavigationMenu): improve generic types (#2482) Co-authored-by: Benjamin Canac --- src/runtime/components/InputMenu.vue | 6 ++--- src/runtime/components/NavigationMenu.vue | 26 ++++++++++++++-------- src/runtime/components/Select.vue | 6 ++--- src/runtime/components/SelectMenu.vue | 6 ++--- src/runtime/types/utils.ts | 9 +++++--- test/components/NavigationMenu.spec.ts | 27 +++++++++++++++++++++-- test/utils/types.ts | 15 ++++++++++++- 7 files changed, 71 insertions(+), 24 deletions(-) diff --git a/src/runtime/components/InputMenu.vue b/src/runtime/components/InputMenu.vue index a1440770..a3c48018 100644 --- a/src/runtime/components/InputMenu.vue +++ b/src/runtime/components/InputMenu.vue @@ -7,7 +7,7 @@ import _appConfig from '#build/app.config' import theme from '#build/ui/input-menu' import type { UseComponentIconsProps } from '../composables/useComponentIcons' import type { AvatarProps, ChipProps, InputProps } from '../types' -import type { AcceptableValue, ArrayOrWrapped, PartialString, SelectItems, SelectItemType, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils' +import type { AcceptableValue, ArrayOrWrapped, PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils' const appConfig = _appConfig as AppConfig & { ui: { inputMenu: Partial } } @@ -29,7 +29,7 @@ export interface InputMenuItem { type InputMenuVariants = VariantProps -export interface InputMenuProps, I extends SelectItems = SelectItems, V extends SelectItemKey | undefined = undefined, M extends boolean = false> extends Pick, 'defaultValue' | 'selectedValue' | 'open' | 'defaultOpen' | 'searchTerm' | 'disabled' | 'name' | 'resetSearchTermOnBlur'>, UseComponentIconsProps { +export interface InputMenuProps, I extends MaybeArrayOfArray = MaybeArrayOfArray, V extends SelectItemKey | undefined = undefined, M extends boolean = false> extends Pick, 'defaultValue' | 'selectedValue' | 'open' | 'defaultOpen' | 'searchTerm' | 'disabled' | 'name' | 'resetSearchTermOnBlur'>, UseComponentIconsProps { /** * The element or component this component should render as. * @defaultValue 'div' @@ -124,7 +124,7 @@ export interface InputMenuSlots { } - - - -