-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(autocomplete): type for 'title' prop in AutocompleteSection #3959
base: canary
Are you sure you want to change the base?
fix(autocomplete): type for 'title' prop in AutocompleteSection #3959
Conversation
|
@ritikpal1122 is attempting to deploy a commit to the NextUI Inc Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes in this pull request involve updates to the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- packages/components/listbox/src/base/listbox-section-base.tsx (1 hunks)
- packages/utilities/aria-utils/src/collections/section.ts (1 hunks)
🧰 Additional context used
🪛 Biome
packages/components/listbox/src/base/listbox-section-base.tsx
[error] 8-8: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
packages/utilities/aria-utils/src/collections/section.ts
[error] 11-11: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
🔇 Additional comments (2)
packages/utilities/aria-utils/src/collections/section.ts (1)
9-13
: LGTM! Type enhancement improves flexibility and type safety.
The addition of the OmitKeys
generic parameter with default values "children" | "title" provides better type control and aligns well with the PR's objective of improving type safety.
🧰 Tools
🪛 Biome
[error] 11-11: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
packages/components/listbox/src/base/listbox-section-base.tsx (1)
8-9
: LGTM! Good improvement in type safety.
The explicit type parameters for "children" and "title" in the SectionProps
extension enhance type safety and provide better TypeScript support, which directly addresses the PR objective.
🧰 Tools
🪛 Biome
[error] 8-8: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Please also update the documentation.
| title | `string` | The title of the listbox section. | - | |
export type SectionProps< | ||
Type extends As = "div", | ||
T extends object = {}, | ||
OmitKeys extends string = "children" | "title", | ||
> = BaseSectionProps<T> & Omit<HTMLNextUIProps<Type>, OmitKeys>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export type SectionProps< | |
Type extends As = "div", | |
T extends object = {}, | |
OmitKeys extends string = "children" | "title", | |
> = BaseSectionProps<T> & Omit<HTMLNextUIProps<Type>, OmitKeys>; | |
export type SectionProps<Type extends As = "div", T extends object = {}> = BaseSectionProps<T> & | |
Omit<HTMLNextUIProps<Type>, "children" | "title">; |
It would be better if the title
of BaseSectionProps
is used.
https://github.com/adobe/react-spectrum/blob/07431f4b1809bc2b1b015149737e08db60d5c332/packages/%40react-types/shared/src/collections.d.ts#L44-L45
Closes #3911
📝 Description
This PR adds a type definition for the
title
prop in theAutocompleteSection
component. This change enhances type safety and improves the developer experience by providing better autocompletion and error checking in TypeScript.⛳️ Current behavior (updates)
Currently, the
title
prop in theAutocompleteSection
component does not have a defined type, which can lead to potential runtime errors and confusion for developers using the component.🚀 New behavior
With this PR, the
title
prop is now defined with a specific type, ensuring that it accepts only valid values. This change will help prevent errors and provide clearer documentation for developers.💣 Is this a breaking change (Yes/No):
No
📝 Additional Information
AutocompleteSection
component.title
prop.Summary by CodeRabbit
Summary by CodeRabbit
ListboxSectionBaseProps
interface to includechildren
andtitle
properties for better customization in listbox sections.SectionProps
type to allow for more flexible omission of properties, improving component construction and customization options.