From 11af3723ec861e39a471797126381c5edbe19dcc Mon Sep 17 00:00:00 2001 From: DebugDynamo Date: Tue, 29 Oct 2024 11:47:31 +0530 Subject: [PATCH 1/2] feat: add type for 'title' prop in AutocompleteSection component --- .../components/listbox/src/base/listbox-section-base.tsx | 3 ++- packages/utilities/aria-utils/src/collections/section.ts | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/components/listbox/src/base/listbox-section-base.tsx b/packages/components/listbox/src/base/listbox-section-base.tsx index bdca28da33..346cdd6776 100644 --- a/packages/components/listbox/src/base/listbox-section-base.tsx +++ b/packages/components/listbox/src/base/listbox-section-base.tsx @@ -5,7 +5,8 @@ import {DividerProps} from "@nextui-org/divider"; import {ListboxItemProps} from "../listbox-item"; -export interface ListboxSectionBaseProps extends SectionProps<"ul", T> { +export interface ListboxSectionBaseProps + extends SectionProps<"ul", T, "children" | "title"> { /** * The listbox section classNames. */ diff --git a/packages/utilities/aria-utils/src/collections/section.ts b/packages/utilities/aria-utils/src/collections/section.ts index 949092c64e..ec434fd5b8 100644 --- a/packages/utilities/aria-utils/src/collections/section.ts +++ b/packages/utilities/aria-utils/src/collections/section.ts @@ -6,5 +6,8 @@ import {HTMLNextUIProps, As} from "@nextui-org/system"; * A modified version of the SectionProps from @react-types/shared, with the addition of the NextUI props. * */ -export type SectionProps = BaseSectionProps & - Omit, "children">; +export type SectionProps< + Type extends As = "div", + T extends object = {}, + OmitKeys extends string = "children" | "title", +> = BaseSectionProps & Omit, OmitKeys>; From cfaed1ad45554076f63823071458faad137a948d Mon Sep 17 00:00:00 2001 From: DebugDynamo Date: Tue, 29 Oct 2024 12:14:25 +0530 Subject: [PATCH 2/2] refactor: improve type safety in ListboxSectionBaseProps --- packages/components/listbox/src/base/listbox-section-base.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/listbox/src/base/listbox-section-base.tsx b/packages/components/listbox/src/base/listbox-section-base.tsx index 346cdd6776..aeedc243c0 100644 --- a/packages/components/listbox/src/base/listbox-section-base.tsx +++ b/packages/components/listbox/src/base/listbox-section-base.tsx @@ -5,7 +5,7 @@ import {DividerProps} from "@nextui-org/divider"; import {ListboxItemProps} from "../listbox-item"; -export interface ListboxSectionBaseProps +export interface ListboxSectionBaseProps> extends SectionProps<"ul", T, "children" | "title"> { /** * The listbox section classNames.