[TypeScript] Add DataConsumer type, and DataKey generics#6943
Conversation
WalkthroughGeneralizes chart data typing by introducing DataProvider/DataConsumer generics and migrating component-level Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6943 +/- ##
=======================================
Coverage 91.37% 91.37%
=======================================
Files 505 505
Lines 37754 37754
Branches 5271 5271
=======================================
Hits 34497 34497
Misses 3248 3248
Partials 9 9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Bundle ReportChanges will increase total bundle size by 2.15kB (0.08%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: recharts/bundle-cjsAssets Changed:
view changes for bundle: recharts/bundle-es6Assets Changed:
|
|
Staging Deployment Details
These deployments will remain available for 30 days. To update snapshots: Comment |
c484133 to
e72fc5f
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/util/types.ts (1)
1354-1402:⚠️ Potential issue | 🟡 MinorExport
DataConsumerandDataProviderfrom the public API entry point.The
DataProviderandDataConsumerinterfaces have comprehensive JSDoc comments and clearly separate concerns between components that accept data arrays and those that extract values viadataKey. However, they are not exported fromsrc/index.ts, yet they are extended by many exported components (Pie, Bar, Area, Line, Scatter, RadialBar, Radar, Brush, Treemap, ZAxis, and others).Since users extending or typing these components would need to import from internal paths (
recharts/util/types), this violates the guideline that all imports must use the public API entry point. Add these interfaces to the public API exports insrc/index.tsto ensure proper API completeness.
|
Staging Deployment Details
These deployments will remain available for 30 days. To update snapshots: Comment |
Description
Put the
dataKeyprop in a shared interface, then reuse the interface. Adds generics, though for now they are all justany, any.Related Issue
#6645
Motivation and Context
Breaking down #6867 into smaller, manageable chunks.
Summary by CodeRabbit
Refactor
Documentation
Chores