Skip to content

fix(PolarRadiusAxis): update ticks prop type#7112

Merged
PavelVanecek merged 1 commit intomainfrom
polarradiusaxis-ticks-type
Mar 8, 2026
Merged

fix(PolarRadiusAxis): update ticks prop type#7112
PavelVanecek merged 1 commit intomainfrom
polarradiusaxis-ticks-type

Conversation

@PavelVanecek
Copy link
Copy Markdown
Collaborator

@PavelVanecek PavelVanecek commented Mar 8, 2026

Description

Type change only

Related Issue

Fixes #4668

Summary by CodeRabbit

  • Refactor

    • Updated the ticks prop type on PolarRadiusAxis from TickItem to AxisTick for improved type consistency.
    • Removed TypeScript error suppression comments to enforce strict type validation.
  • Documentation

    • Enhanced AxisTick type documentation with inline formatting.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 8, 2026

Walkthrough

This PR corrects the TypeScript type definition for the ticks prop on PolarRadiusAxis from TickItem to AxisTick (number | string), aligning the published API type with the actual implementation that expects primitive values rather than objects.

Changes

Cohort / File(s) Summary
Type System Alignment
src/polar/PolarRadiusAxis.tsx
Changed ticks prop type from ReadonlyArray<TickItem> to ReadonlyArray<AxisTick>, removed ts-expect-error suppression since the types now align.
Documentation
src/util/types.ts
Added @inline JSDoc tag and formatting to AxisTick type definition; no functional changes.
Test Updates
test/polar/PolarRadiusAxis.spec.tsx
Removed ts-expect-error comment from ticks prop to enable stricter TypeScript validation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • ckifer
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is minimal but includes a brief explanation and references the related issue; however it lacks details about motivation, testing, and missing required template sections. Add sections for Motivation and Context, How Has This Been Tested, and complete the Types of changes and Checklist sections per the template.
Linked Issues check ❓ Inconclusive The PR changes the AxisTick type usage but does not fully resolve issue #4668's root concern of incorrect type validation or implementation mismatch. Clarify whether changing ticks type from TickItem to AxisTick (number | string) fully resolves the reported bug or if additional implementation changes are needed.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix(PolarRadiusAxis): update ticks prop type' clearly and accurately summarizes the main change of updating the type definition for the ticks prop.
Out of Scope Changes check ✅ Passed All changes are directly related to updating the ticks prop type for PolarRadiusAxis as specified in issue #4668; no out-of-scope changes detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch polarradiusaxis-ticks-type

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/polar/PolarRadiusAxis.tsx (1)

200-200: Type fix correctly aligns with implementation.

This change properly narrows the ticks prop type from TickItem (object with coordinate, value, index, etc.) to AxisTick (primitive number | string), matching what the implementation actually accepts. This resolves issue #4668 where users had to cast numeric arrays to satisfy the incorrect type.

Consider adding a JSDoc comment to document this prop for the API documentation:

📝 Optional: Add JSDoc for the ticks prop
   tick?: TickProp<BaseTickContentProps>;
+  /**
+   * Set the values of axis ticks manually.
+   * When this prop is set, the axis will use these values instead of computing them from the data.
+   */
   ticks?: ReadonlyArray<AxisTick>;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/polar/PolarRadiusAxis.tsx` at line 200, The ticks prop type is currently
incorrect (was using TickItem) and needs to be narrowed to AxisTick to match the
implementation that accepts primitive tick values; update the ticks declaration
in PolarRadiusAxis (the prop/interface where "ticks" is defined) to use
ReadonlyArray<AxisTick> instead of TickItem[] (or similar), and add a concise
JSDoc above the ticks prop describing it accepts an array of primitive tick
values (number | string) so API docs reflect the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/polar/PolarRadiusAxis.tsx`:
- Line 200: The ticks prop type is currently incorrect (was using TickItem) and
needs to be narrowed to AxisTick to match the implementation that accepts
primitive tick values; update the ticks declaration in PolarRadiusAxis (the
prop/interface where "ticks" is defined) to use ReadonlyArray<AxisTick> instead
of TickItem[] (or similar), and add a concise JSDoc above the ticks prop
describing it accepts an array of primitive tick values (number | string) so API
docs reflect the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 79773ba1-0e55-4185-8966-101f852cd741

📥 Commits

Reviewing files that changed from the base of the PR and between da03436 and 4af3725.

📒 Files selected for processing (3)
  • src/polar/PolarRadiusAxis.tsx
  • src/util/types.ts
  • test/polar/PolarRadiusAxis.spec.tsx
💤 Files with no reviewable changes (1)
  • test/polar/PolarRadiusAxis.spec.tsx

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 8, 2026

Bundle Report

Changes will decrease total bundle size by 241 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.29MB -85 bytes (-0.01%) ⬇️
recharts/bundle-es6 1.12MB -85 bytes (-0.01%) ⬇️
recharts/bundle-treeshaking-polar 443.06kB -85 bytes (-0.02%) ⬇️
recharts/bundle-treeshaking-cartesian 638.76kB 14 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-treeshaking-polar

Assets Changed:

Asset Name Size Change Total Size Change (%)
bundle.js -85 bytes 443.06kB -0.02%
view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
polar/PolarRadiusAxis.js -99 bytes 11.69kB -0.84%
util/types.js 14 bytes 9.63kB 0.15%
view changes for bundle: recharts/bundle-treeshaking-cartesian

Assets Changed:

Asset Name Size Change Total Size Change (%)
bundle.js 14 bytes 638.76kB 0.0%
view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
polar/PolarRadiusAxis.js -99 bytes 10.24kB -0.96%
util/types.js 14 bytes 9.22kB 0.15%

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.61%. Comparing base (9206425) to head (4af3725).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7112   +/-   ##
=======================================
  Coverage   89.61%   89.61%           
=======================================
  Files         534      534           
  Lines       40285    40294    +9     
  Branches     5486     5490    +4     
=======================================
+ Hits        36100    36109    +9     
  Misses       4177     4177           
  Partials        8        8           

☔ 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
Copy Markdown
Contributor

github-actions bot commented Mar 8, 2026

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.

@PavelVanecek PavelVanecek merged commit cd13b81 into main Mar 8, 2026
49 checks passed
@PavelVanecek PavelVanecek deleted the polarradiusaxis-ticks-type branch March 8, 2026 07:20
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.

PolarRadiusAxis inside RadarChart uses wrong type for ticks prop

1 participant