@@ -29,12 +29,16 @@ import { Path, To } from 'react-router';
2929 *
3030 */
3131type ButtonComponent = < RootComponent extends React . ElementType = 'button' > (
32- props : ButtonProps < RootComponent > & React . RefAttributes < HTMLElement >
32+ props : ButtonProps < RootComponent > &
33+ React . RefAttributes < HTMLButtonElement | HTMLAnchorElement >
3334) => React . ReactElement | null ;
3435
3536export const Button = React . forwardRef ( function Button <
3637 RootComponent extends React . ElementType = 'button' ,
37- > ( inProps : ButtonProps < RootComponent > , ref : React . ForwardedRef < HTMLElement > ) {
38+ > (
39+ inProps : ButtonProps < RootComponent > ,
40+ ref : React . ForwardedRef < HTMLButtonElement | HTMLAnchorElement >
41+ ) {
3842 const props = useThemeProps ( { props : inProps , name : PREFIX } ) ;
3943 const {
4044 alignIcon = 'left' ,
@@ -65,7 +69,7 @@ export const Button = React.forwardRef(function Button<
6569 label && ! disabled ? (
6670 < Tooltip title = { translatedLabel } >
6771 < IconButton
68- ref = { ref }
72+ ref = { ref as React . Ref < HTMLButtonElement > }
6973 // If users provide a ReactNode as label, its their responsibility to also provide an aria-label should they need it
7074 aria-label = {
7175 typeof translatedLabel === 'string'
@@ -83,7 +87,7 @@ export const Button = React.forwardRef(function Button<
8387 </ Tooltip >
8488 ) : (
8589 < IconButton
86- ref = { ref }
90+ ref = { ref as React . Ref < HTMLButtonElement > }
8791 className = { className }
8892 color = { color }
8993 disabled = { disabled }
@@ -96,7 +100,7 @@ export const Button = React.forwardRef(function Button<
96100 )
97101 ) : (
98102 < StyledButton
99- ref = { ref }
103+ ref = { ref as React . Ref < HTMLButtonElement > }
100104 className = { className }
101105 color = { color }
102106 size = { size }
0 commit comments