Skip to content

[GSOC 2026] - fix(theme): correctly render intersection types with '&' instead of '|' separator#61

Closed
soumyarajbag wants to merge 1 commit intowebpack:mainfrom
soumyarajbag:fix/intersection-type-separator
Closed

[GSOC 2026] - fix(theme): correctly render intersection types with '&' instead of '|' separator#61
soumyarajbag wants to merge 1 commit intowebpack:mainfrom
soumyarajbag:fix/intersection-type-separator

Conversation

@soumyarajbag
Copy link
Copy Markdown

@soumyarajbag soumyarajbag commented Mar 29, 2026

Fixes for #7

Summary

The resolve function in plugins/theme/partials/types.mjs handled union and
intersection types in the same case block, causing intersection types to be rendered
with | (the union separator) instead of &.

This means any TypeScript intersection type like A & B was being incorrectly documented
as A|B, making it indistinguishable from a union type A | B.

Concrete examples from the generated output:

  • cleverMerge in util returns T | O | (T & O) — rendered as {T|O|T|O} instead of
    {T|O|T&O}
  • schema parameter type is (JSONSchema4 & ExtendedSchema) | (JSONSchema6 & ExtendedSchema) | ... — rendered as
    {JSONSchema4|ExtendedSchema|JSONSchema6|ExtendedSchema|...} instead of
    {JSONSchema4&ExtendedSchema|JSONSchema6&ExtendedSchema|...}

What kind of change does this PR introduce?

fix

Did you add tests for your changes?

No tests were added. The fix is verified by regenerating the docs (npm run generate-docs) and confirming the output in pages/v5.x/ now correctly uses & for
intersection types.

Does this PR introduce a breaking change?

No. This corrects the rendered Markdown output to accurately reflect the actual
TypeScript types. The generated pages in pages/v5.x/ are updated accordingly.

If relevant, what needs to be documented once your changes are merged or what have you
already documented?

No documentation changes needed. The fix itself corrects the generated documentation
output.

Use of AI

Claude (claude-sonnet-4-6) was used to assist with identifying the bug by auditing the
generated Markdown output against the original TypeScript type definitions in
webpack/types.d.ts. The fix itself (splitting the union/intersection case block)
was reviewed and understood before being applied.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 29, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: soumyarajbag / name: Soumyaraj Bag (9330066)

@soumyarajbag soumyarajbag force-pushed the fix/intersection-type-separator branch from 8834ff4 to 9330066 Compare March 29, 2026 10:29
@avivkeller
Copy link
Copy Markdown
Member

It's set up as it is correctly intentionally. Please actually understand the code base before sending PRs.

@avivkeller avivkeller closed this Mar 29, 2026
@soumyarajbag
Copy link
Copy Markdown
Author

Hey @avivkeller - then is there any other issue - I may be able to contribute and I am interested to submit proposal as a GSOC 2026 Contributor so if you could provide some issues if opened.

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.

2 participants