Skip to content

docs: clarify valid types for axis tick prop#7191

Merged
PavelVanecek merged 1 commit into
recharts:mainfrom
Harikrushn9118:fix-axis-tick-docs-clean
Mar 30, 2026
Merged

docs: clarify valid types for axis tick prop#7191
PavelVanecek merged 1 commit into
recharts:mainfrom
Harikrushn9118:fix-axis-tick-docs-clean

Conversation

@Harikrushn9118

@Harikrushn9118 Harikrushn9118 commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #2940 by increasing the threshold for rendering generic (union of N variants) strings in the API doc generation plugin. This explicitly lists out tick and label's proper render types including Function and ReactElement instead of (union of 5 variants).

Summary by CodeRabbit

  • Documentation
    • Added compiler optimization directives to enhance build and processing performance without affecting user-facing functionality.

@coderabbitai

coderabbitai Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: be250c51-ab6b-4c19-a4ca-665aec145893

📥 Commits

Reviewing files that changed from the base of the PR and between 72ed283 and 741893a.

📒 Files selected for processing (1)
  • src/util/types.ts
✅ Files skipped from review due to trivial changes (1)
  • src/util/types.ts

Walkthrough

Added a JSDoc @inline annotation to the exported TickProp<T> type alias in src/util/types.ts. This is a documentation directive with no impact on the type structure or exported API.

Changes

Cohort / File(s) Summary
Type Documentation
src/util/types.ts
Added @inline JSDoc annotation to TickProp<T> type alias for improved type documentation and inference.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 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 PR description explains the issue being fixed and references the related issue, but lacks several template sections like Motivation/Context, Testing, and checklist items. Complete the PR description template by adding sections for Motivation and Context, How Has This Been Tested, and checking relevant items in the Types of changes and Checklist.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'docs: clarify valid types for axis tick prop' accurately describes the main change - adding JSDoc documentation to clarify the TickProp type.
Linked Issues check ✅ Passed The PR changes align with issue #2940's objective to make API documentation show that tick accepts function renderers and React elements by adding JSDoc clarification.
Out of Scope Changes check ✅ Passed The change adds only a JSDoc annotation to clarify the TickProp type, which is directly related to fixing issue #2940 and improving documentation clarity.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
omnidoc/generateApiDoc.ts (1)

99-106: Cover the new 6-variant cutoff with boundary tests.

Line 100 changes a behavior boundary, but there’s no explicit spec for unions of exactly 5 and 6 variants. Please add boundary tests so this cutoff is locked and future refactors don’t silently revert it.

Proposed test additions
diff --git a/omnidoc/processType.spec.ts b/omnidoc/processType.spec.ts
@@
 describe('processType', () => {
+  it('should inline unions with 5 variants', () => {
+    const input = ['"a"', '"b"', '"c"', '"d"', '"e"'];
+    expect(processType(input, false)).toBe('"a" | "b" | "c" | "d" | "e"');
+  });
+
+  it('should inline unions with 6 variants', () => {
+    const input = ['"a"', '"b"', '"c"', '"d"', '"e"', '"f"'];
+    expect(processType(input, false)).toBe('"a" | "b" | "c" | "d" | "e" | "f"');
+  });
+
+  it('should collapse unions with 7 variants', () => {
+    const input = ['"a"', '"b"', '"c"', '"d"', '"e"', '"f"', '"g"'];
+    expect(processType(input, false)).toBe('(union of 7 variants)');
+  });
+
   it('should handle simple unions', () => {
     expect(processType(['string', 'number'], false)).toBe('number | string');
   });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@omnidoc/generateApiDoc.ts` around lines 99 - 106, Add unit tests that assert
the union-formatting behavior at the new 6-variant boundary: create tests that
feed the logic (the code using isInline and uniqueParts in generateApiDoc.ts)
with exactly 5 and exactly 6 distinct union variants and verify the output is
the alphabetically sorted "A | B | C ..." string (i.e., joined with ' | '), and
also include a test with 7 variants to assert the alternative path (not joined)
still applies; locate the union formatting logic by the symbols isInline and
uniqueParts in generateApiDoc.ts and add these cases to the existing test suite
so the 5/6/7 variant behavior is locked.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@omnidoc/generateApiDoc.ts`:
- Around line 99-106: Add unit tests that assert the union-formatting behavior
at the new 6-variant boundary: create tests that feed the logic (the code using
isInline and uniqueParts in generateApiDoc.ts) with exactly 5 and exactly 6
distinct union variants and verify the output is the alphabetically sorted "A |
B | C ..." string (i.e., joined with ' | '), and also include a test with 7
variants to assert the alternative path (not joined) still applies; locate the
union formatting logic by the symbols isInline and uniqueParts in
generateApiDoc.ts and add these cases to the existing test suite so the 5/6/7
variant behavior is locked.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c35a39cc-f922-440d-8239-9e132f8dd68a

📥 Commits

Reviewing files that changed from the base of the PR and between fc96239 and 72ed283.

📒 Files selected for processing (1)
  • omnidoc/generateApiDoc.ts

@codecov

codecov Bot commented Mar 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.06%. Comparing base (fc96239) to head (741893a).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7191   +/-   ##
=======================================
  Coverage   89.06%   89.06%           
=======================================
  Files         539      539           
  Lines       41011    41011           
  Branches     5553     5553           
=======================================
  Hits        36527    36527           
  Misses       4476     4476           
  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.

@PavelVanecek PavelVanecek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You could also add @inline annotation on the type and that would expand it.

@codecov

codecov Bot commented Mar 30, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 80 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.3MB 20 bytes (0.0%) ⬆️
recharts/bundle-es6 1.13MB 20 bytes (0.0%) ⬆️
recharts/bundle-treeshaking-cartesian 644.11kB 20 bytes (0.0%) ⬆️
recharts/bundle-treeshaking-polar 448.49kB 20 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

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

Assets Changed:

Asset Name Size Change Total Size Change (%)
bundle.js 20 bytes 644.11kB 0.0%
view changes for bundle: recharts/bundle-treeshaking-polar

Assets Changed:

Asset Name Size Change Total Size Change (%)
bundle.js 20 bytes 448.49kB 0.0%
view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
util/types.js 20 bytes 9.7kB 0.21%
view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
util/types.js 20 bytes 9.28kB 0.22%

Fixes recharts#2940 by adding the @inline JSDoc tag to TickProp. This ensures the omnidoc generator explicitly lists out the supported types (Function, ReactNode, etc.) for the tick prop instead of obscuring them behind a generic '(union of 5 variants)'.
@Harikrushn9118
Harikrushn9118 force-pushed the fix-axis-tick-docs-clean branch from 72ed283 to 741893a Compare March 30, 2026 16:27
@PavelVanecek
PavelVanecek merged commit badc91c into recharts:main Mar 30, 2026
52 checks passed
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.

Documentation regarding component customisation is contradictory.

2 participants