Skip to content

fix(type-annotations): space union separators in type values#942

Open
btea wants to merge 3 commits into
nodejs:mainfrom
btea:fix/type-annotation-union-spacing
Open

fix(type-annotations): space union separators in type values#942
btea wants to merge 3 commits into
nodejs:mainfrom
btea:fix/type-annotation-union-spacing

Conversation

@btea

@btea btea commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Description

In the documentation, parameter descriptions should be similar to parameter types in the code, with spaces between multiple types and the | identifier for a more consistent look.

old new
image image

Validation

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@btea
btea requested a review from a team as a code owner July 26, 2026 04:13
Copilot AI review requested due to automatic review settings July 26, 2026 04:13
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Jul 26, 2026 4:24am

Request Review

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

@btea is attempting to deploy a commit to the OpenJS Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@cursor

cursor Bot commented Jul 26, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Localized formatting in the type-annotation markdown pipeline; no auth, data, or runtime API changes, though link offsets could theoretically shift if they were computed against pre-normalization strings elsewhere.

Overview
Type annotation values parsed from {...} prose are now canonicalized with spaced union separators (string | URL instead of string|URL), including GFM table escapes and messy whitespace, so rendered docs match typical TypeScript style.

Normalization runs in typeAnnotationFromMarkdown via a new UNION_SEPARATOR regex that rewrites lone | while leaving || unchanged (e.g. default-value expressions like req.url || '/'). Remark tests and a patch changeset cover the behavior and markdown round-trip.

Reviewed by Cursor Bugbot for commit 3b70340. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.20%. Comparing base (38710ef) to head (3b70340).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #942      +/-   ##
==========================================
+ Coverage   86.19%   86.20%   +0.01%     
==========================================
  Files         195      195              
  Lines       17657    17673      +16     
  Branches     1605     1606       +1     
==========================================
+ Hits        15219    15235      +16     
  Misses       2432     2432              
  Partials        6        6              

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1106e95. Configure here.

Comment thread src/utils/type-annotations/mdast.mjs Outdated
Comment thread src/utils/type-annotations/mdast.mjs Outdated

@avivkeller avivkeller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add a patch changeset, thank you!

Copilot AI review requested due to automatic review settings July 26, 2026 04:19

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@btea

btea commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Please add a patch changeset, thank you!

Done.

Copilot AI review requested due to automatic review settings July 26, 2026 04:23

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AugustinMauroy AugustinMauroy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGMT !

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.

4 participants