Skip to content

Fix mouse event type#6939

Merged
ckifer merged 1 commit intomainfrom
mouseevent-type
Jan 28, 2026
Merged

Fix mouse event type#6939
ckifer merged 1 commit intomainfrom
mouseevent-type

Conversation

@PavelVanecek
Copy link
Collaborator

@PavelVanecek PavelVanecek commented Jan 28, 2026

Description

Updates the type and removes ts-expect-error

Related Issue

#6645

Summary by CodeRabbit

  • Refactor
    • Improved TypeScript type safety and consistency across chart components (Bar, Funnel, Scatter, Pie, RadialBar) by refining event handler typing.
    • Simplified tooltip event handling system with clearer generic type definitions.
    • Removed TypeScript error suppressions, enabling better compile-time type checking throughout the charting library.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

Walkthrough

This PR refactors tooltip event handler typing across multiple chart components. The central change introduces new generic event types in tooltipContext.tsx, which enables removal of TypeScript error suppressions in Bar, Funnel, Scatter, Pie, and RadialBar components. Internal prop types in Bar are updated to use InternalProps for stricter event handler alignment.

Changes

Cohort / File(s) Summary
Tooltip Event Type System
src/context/tooltipContext.tsx
Introduces new generic MouseEnterLeaveEvent<T, E> type replacing ActivateTooltipAction<T>. Refactors TooltipTriggerInfo to use optional fields. Updates three hooks (useMouseEnterItemDispatch, useMouseLeaveItemDispatch, useMouseClickItemDispatch) to accept data payload T and SVG element type E, enabling stricter typing for event handlers across components.
Bar Component Type Refinement
src/cartesian/Bar.tsx
Changes BarBackgroundProps and BarRectanglesProps types to use InternalProps instead of public Props, enabling internal id handling for event dispatchers. Removes redundant @ts-expect-error comments that become unnecessary with improved type alignment.
Event Handler Error Suppressions Removal
src/cartesian/Funnel.tsx, src/cartesian/Scatter.tsx, src/polar/Pie.tsx, src/polar/RadialBar.tsx
Removes @ts-expect-error annotations from onMouseEnter, onMouseLeave, and onClick event handler props, now properly typed via updated tooltip context hooks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

refactor

Suggested reviewers

  • ckifer
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is minimal but covers the essential changes. However, it is missing several sections from the template including Motivation and Context, testing details, and type of changes checklist. Expand the description to include Motivation and Context explaining why the type changes were needed, details on how the changes were tested, and check the appropriate boxes for type of changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix mouse event type' is concise and clearly relates to the main change of refactoring mouse event typing and removing type suppression comments throughout the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.30%. Comparing base (265bb5b) to head (2bb749d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6939   +/-   ##
=======================================
  Coverage   94.30%   94.30%           
=======================================
  Files         573      573           
  Lines       56891    56891           
  Branches     5254     5254           
=======================================
  Hits        53653    53653           
  Misses       3229     3229           
  Partials        9        9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@ckifer ckifer merged commit e556287 into main Jan 28, 2026
47 checks passed
@PavelVanecek PavelVanecek deleted the mouseevent-type branch January 28, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants