Skip to content

Commit

Permalink
fix(button & dropdownitem): reverts return type of Button & DropdownI…
Browse files Browse the repository at this point in the history
…tem to JSX.Element

In themesberg#1244, the return type of Button and DropdownItem was changed to ReactNode. This is not an
acceptable return type for functional components. The correct return type is JSX.Element. This
change fixes the regression from that PR (introduced in v v0.7.3 A Also fixes  themesberg#962.

fix themesberg#962
  • Loading branch information
rnicholus committed Mar 14, 2024
1 parent 31c9d9d commit 12a345c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export type ButtonProps<T extends ElementType = 'button'> = PolymorphicComponent

type ButtonComponentType = (<C extends React.ElementType = 'button'>(
props: ButtonProps<C>,
) => React.ReactNode | null) & { displayName?: string };
) => JSX.Element | null) & { displayName?: string };

const ButtonComponentFn: ButtonComponentType = forwardRef(
<T extends ElementType = 'button'>(
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dropdown/DropdownItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type DropdownItemProps<T extends ElementType = 'button'> = PolymorphicCom

type DropdownItemComponentType = (<C extends React.ElementType = 'button'>(
props: DropdownItemProps<C>,
) => React.ReactNode | null) & { displayName?: string };
) => JSX.Element | null) & { displayName?: string };

export const DropdownItem: DropdownItemComponentType = forwardRef(
<T extends ElementType = 'button'>(
Expand Down

0 comments on commit 12a345c

Please sign in to comment.