Skip to content

Commit

Permalink
fix(ButtonClose): update types for React 18 (#2658)
Browse files Browse the repository at this point in the history
* fix(ButtonClose): update types for React 18

* chore: add changeset

* chore: add lint ignore
  • Loading branch information
joshblack authored Dec 16, 2022
1 parent 1fb6ee9 commit 20e18c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/lazy-beans-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Update TypeScript types for deprecated ButtonClose to support React 18
8 changes: 7 additions & 1 deletion src/deprecated/Button/ButtonClose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ const StyledButton = styled.button<SxProp>`
${sx};
`

const ButtonClose = forwardRef<HTMLButtonElement, ComponentProps<typeof StyledButton>>((props, ref) => {
const ButtonClose = forwardRef<
HTMLButtonElement,
// Include {theme?: any} in the intersection as it mirrors the generated type
// from styled-components
// eslint-disable-next-line @typescript-eslint/no-explicit-any
React.ButtonHTMLAttributes<HTMLButtonElement> & {theme?: any} & SxProp
>((props, ref) => {
return (
<StyledButton ref={ref} aria-label="Close" {...props}>
<XIcon />
Expand Down

0 comments on commit 20e18c0

Please sign in to comment.