Skip to content

Commit

Permalink
refactor: remove unnecessary props types (#4530)
Browse files Browse the repository at this point in the history
* refactor(docs): remove string type as it is included in ReactNode

* refactor: remove unnecessary types

* feat(changeset): add changeset

* chore: remove changeset

* refactor: remove null since ReactNode unions it already
  • Loading branch information
wingkwong authored Jan 13, 2025
1 parent fcdf24a commit 26fc514
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions apps/docs/content/docs/components/accordion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,19 @@ Here's an example of how to customize the accordion styles:
data={[
{
attribute: "children",
type: "ReactNode | string",
type: "ReactNode",
description: "The content of the component.",
default: "-"
},
{
attribute: "title",
type: "ReactNode | string",
type: "ReactNode",
description: "The accordion item title.",
default: "-"
},
{
attribute: "subtitle",
type: "ReactNode | string",
type: "ReactNode",
description: "The accordion item subtitle.",
default: "-"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/components/navbar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ When the `NavbarItem` is active, it will have a `data-active` attribute. You can
data={[
{
attribute: "icon",
type: "ReactNode | ((isOpen: boolean | undefined) => ReactNode | null)",
type: "ReactNode | ((isOpen: boolean | undefined) => ReactNode)",
description: "The icon to render as the navbar menu toggle.",
default: "-"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/components/accordion/src/accordion-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const AccordionItem = forwardRef<"button", AccordionItemProps>((props, ref) => {

const willChange = useWillChange();

const indicatorContent = useMemo<ReactNode | null>(() => {
const indicatorContent = useMemo<ReactNode>(() => {
if (typeof indicator === "function") {
return indicator({indicator: <ChevronIcon />, isOpen, isDisabled});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ export interface Props<T extends object = {}>
/**
* The content of the component.
*/
children?: ReactNode | null;
children?: ReactNode;
/**
* The accordion item title.
*/
title?: ReactNode | string;
title?: ReactNode;
/**
* The accordion item subtitle.
*/
subtitle?: ReactNode | string;
subtitle?: ReactNode;
/**
* The accordion item `expanded` indicator, it's usually an arrow icon.
* If you pass a function, NextUI will expose the current indicator and the open status,
Expand Down
6 changes: 3 additions & 3 deletions packages/components/listbox/src/base/listbox-item-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ interface Props<T extends object = {}> extends Omit<ItemProps<"li", T>, "childre
/**
* The content of the component.
*/
children?: ReactNode | null;
children?: ReactNode;
/**
* The listbox item title.
*/
title?: ReactNode | string;
title?: ReactNode;
/**
* The listbox item subtitle.
*/
description?: ReactNode | string;
description?: ReactNode;
/**
* The listbox item start content.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/components/listbox/src/listbox-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ListboxItem = (props: ListboxItemProps) => {
getSelectedIconProps,
} = useListboxItem(props);

const selectedContent = useMemo<ReactNode | null>(() => {
const selectedContent = useMemo<ReactNode>(() => {
const defaultIcon = (
<ListboxSelectedIcon disableAnimation={disableAnimation} isSelected={isSelected} />
);
Expand Down
8 changes: 4 additions & 4 deletions packages/components/menu/src/base/menu-item-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ interface Props<T extends object = {}> extends Omit<ItemProps<"li", T>, "childre
/**
* The content of the component.
*/
children?: ReactNode | null;
children?: ReactNode;
/**
* The menu item title.
*/
title?: ReactNode | string;
title?: ReactNode;
/**
* The menu item subtitle.
*/
description?: ReactNode | string;
description?: ReactNode;
/**
* The menu item keyboard shortcut.
*/
shortcut?: ReactNode | string;
shortcut?: ReactNode;
/**
* The menu item start content.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/components/menu/src/menu-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const MenuItem = (props: MenuItemProps) => {
getSelectedIconProps,
} = useMenuItem(props);

const selectedContent = useMemo<ReactNode | null>(() => {
const selectedContent = useMemo<ReactNode>(() => {
const defaultIcon = (
<MenuSelectedIcon disableAnimation={disableAnimation} isSelected={isSelected} />
);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/snippet/src/use-snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface UseSnippetProps extends Omit<HTMLNextUIProps, "onCopy">, Snippe
* The content of the snippet.
* if `string[]` is passed, it will be rendered as a multi-line snippet.
*/
children?: React.ReactNode | string | string[];
children?: React.ReactNode | string[];
/**
* The symbol to show before the snippet.
* @default "$"
Expand Down
4 changes: 2 additions & 2 deletions packages/components/tabs/src/base/tab-item-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ interface Props<T extends object = {}> extends Omit<ItemProps<"button", T>, "chi
/**
* The content of the component.
*/
children?: ReactNode | null;
children?: ReactNode;
/**
* The title of the component.
*/
title?: ReactNode | null;
title?: ReactNode;
/**
* A string representation of the item's contents. Use this when the title is not readable.
* This will be used as native `title` attribute.
Expand Down
4 changes: 2 additions & 2 deletions packages/components/user/src/use-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ interface Props {
/**
* The user name.
*/
name: ReactNode | string;
name: ReactNode;
/**
* The user information, like email, phone, etc.
*/
description?: ReactNode | string;
description?: ReactNode;
/**
* Whether the user can be focused.
* @default false
Expand Down

0 comments on commit 26fc514

Please sign in to comment.