-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong PointMouseHandler
type on event handlers like onMouseMove
#2615
Comments
I also discovered that nivo/packages/line/src/SlicesItem.js Lines 64 to 89 in 839ff6d
And is there a better way to get the current slice/points that is being hovered/touched over? Not sure if this could be related with the type mismatch, if not, I can open a seperate issue. |
Describe/explain the bug
When using event handlers like
onMouseMove
,onMouseEnter
and so on with for example the<ResponsiveLine>
, the return type of the callback parameters is(point: Point, event: React.MouseEvent) => void
in TypeScript. But these types are wrong, since in runtime, the actual type you get is(slice: Slice, event: React.MouseEvent) => void
. So instead of getting just one point, you get the wholeslice
object, including thepoints: Point[]
array.Not sure if it's only for the line chart or others also.
To Reproduce
Steps to reproduce the behavior:
<ResponsiveLine data={...} onMouseMove={(...params) => { console.log(params) }} />
Expected behavior
Types match
The text was updated successfully, but these errors were encountered: