Conversation
This change makes the PieSectorShapeProps type publicly available by: 1. Adding 'export' keyword to the type definition in src/polar/Pie.tsx 2. Re-exporting it from src/index.ts This allows consumers to directly use this type when creating custom shape functions for Pie components, instead of manually recreating it by adding the isActive property to PieSectorDataItem. Fixes recharts#6705
WalkthroughThe PR expands the public API by exporting two type definitions: PieSectorShapeProps from the Pie component and RadialBarProps from the RadialBar component. These changes expose previously internal types to library consumers, with no runtime logic modifications. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Possibly related issues
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. 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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/polar/Pie.tsx (1)
163-163: LGTM! Type export is correctly implemented.The addition of the
exportkeyword successfully makesPieSectorShapePropspublicly available, which achieves the PR's goal of improving developer experience when creating custom Pie shapes.Optional improvement: Consider adding JSDoc documentation similar to
PieSectorDataItemabove (lines 147-156) to help developers understand when and how to use this type:+/** + * Props passed to custom shape functions when rendering Pie sectors. + * Extends PieSectorDataItem with additional rendering state. + */ export type PieSectorShapeProps = PieSectorDataItem & { isActive: boolean; index: number };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/index.ts(1 hunks)src/polar/Pie.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (DEVELOPING.md)
Run ESLint and Prettier on the codebase using
npm run lint
Files:
src/polar/Pie.tsxsrc/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (DEVELOPING.md)
Run type checking on the codebase using
npm run check-types
**/*.{ts,tsx}: Never useanytype (implicit or explicit) in TypeScript code
Preferunknownoveranyand refine the type in TypeScript
Type function parameters and return values explicitly in TypeScript, do not rely on implicit any or inference; exceptions are React components and trivial functions
Do not useastype assertions in TypeScript; the only exception isas const
Files:
src/polar/Pie.tsxsrc/index.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Ensure code lints by running
npm run lintand follows Airbnb's Style Guide
Files:
src/polar/Pie.tsxsrc/index.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not hardcode any strings or formatting choices in library code; users should provide localized strings as desired
Files:
src/polar/Pie.tsxsrc/index.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6669
File: www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx:2-2
Timestamp: 2025-11-23T13:30:10.388Z
Learning: The `TooltipIndex` type from recharts is defined in `src/state/tooltipSlice.ts` but is not currently exported from the public API entry points. It should not be imported from `recharts/types/state/tooltipSlice` as this is an internal implementation path. An ESLint rule is needed to prevent regressions.
📚 Learning: 2025-11-23T13:30:10.388Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6669
File: www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx:2-2
Timestamp: 2025-11-23T13:30:10.388Z
Learning: The `TooltipIndex` type from recharts is defined in `src/state/tooltipSlice.ts` but is not currently exported from the public API entry points. It should not be imported from `recharts/types/state/tooltipSlice` as this is an internal implementation path. An ESLint rule is needed to prevent regressions.
Applied to files:
src/polar/Pie.tsxsrc/index.ts
🧬 Code graph analysis (1)
src/polar/Pie.tsx (1)
src/index.ts (2)
PieSectorShapeProps(61-61)PieSectorDataItem(60-60)
🔇 Additional comments (1)
src/polar/Pie.tsx (1)
56-62: I encountered a repository access issue and cannot clone the codebase to verify the review comment. However, I can note that the provided review comment appears to have mismatched content — the snippet shows imports insrc/polar/Pie.tsx, but the review discussion and scratchpad reference exports fromsrc/index.tsand a different file structure.To proceed with verification, I need either:
- Direct access to the codebase files, or
- Clarification on what changes are actually being reviewed at lines 56-62 of
src/polar/Pie.tsxCould you provide the context again or confirm the actual file path and changes under review?
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6706 +/- ##
=======================================
Coverage 94.02% 94.02%
=======================================
Files 499 499
Lines 42625 42625
Branches 4892 4892
=======================================
Hits 40079 40079
Misses 2541 2541
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@ckifer Please review the changes and suggest improvements if any! |
Export PieSectorShapeProps Type
Summary
This PR makes the
PieSectorShapePropstype publicly available, improving the developer experience when working with custom Pie chart shapes.Problem
Currently, when developers want to create custom shape functions for Pie components, they need to manually recreate the
PieSectorShapePropstype by adding theisActiveproperty toPieSectorDataItem. This is error-prone and requires developers to inspect the internal implementation to understand the shape of the props.Solution
This PR exports the
PieSectorShapePropstype, allowing developers to use it directly:Changes
exportkeyword to thePieSectorShapePropstype definition (line 163)PieSectorShapePropsto the list of exported types from./polar/Pie(line 56)Testing
npm run build-types)Benefits
Fixes
#6705
Summary by CodeRabbit
PieSectorShapePropstype publicly available for use in Pie component implementations.RadialBarPropstype for RadialBar component integration.✏️ Tip: You can customize this high-level summary in your review settings.