Skip to content

Commit cd6e3ec

Browse files
Adrien Gibratplouc
Adrien Gibrat
authored andcommittedDec 17, 2021
fix(bar): avoid to redefine react forwardRef type
1 parent edd3990 commit cd6e3ec

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed
 

‎packages/bar/src/BarCanvas.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ import { renderLegendToCanvas } from '@nivo/legends'
2727
import { useTooltip } from '@nivo/tooltip'
2828
import { useBar } from './hooks'
2929

30-
declare module 'react' {
31-
// eslint-disable-next-line @typescript-eslint/ban-types
32-
function forwardRef<T, P = {}>(
33-
render: (props: P, ref: React.Ref<T>) => React.ReactElement | null
34-
): (props: P & React.RefAttributes<T>) => React.ReactElement | null
35-
}
36-
3730
type InnerBarCanvasProps<RawDatum extends BarDatum> = Omit<
3831
BarCanvasProps<RawDatum>,
3932
'renderWrapper' | 'theme'

‎packages/bar/src/ResponsiveBarCanvas.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ export const ResponsiveBarCanvas = forwardRef(function ResponsiveBarCanvas<
99
return (
1010
<ResponsiveWrapper>
1111
{({ width, height }) => (
12-
<BarCanvas width={width} height={height} {...props} ref={ref} />
12+
<BarCanvas
13+
width={width}
14+
height={height}
15+
{...(props as Omit<BarCanvasProps<BarDatum>, 'height' | 'width'>)}
16+
ref={ref}
17+
/>
1318
)}
1419
</ResponsiveWrapper>
1520
)

0 commit comments

Comments
 (0)
Please sign in to comment.