Skip to content

[code-infra] Upgrade react-docgen to v8#47685

Merged
JCQuintas merged 43 commits intomui:masterfrom
JCQuintas:docgen-v8
Feb 24, 2026
Merged

[code-infra] Upgrade react-docgen to v8#47685
JCQuintas merged 43 commits intomui:masterfrom
JCQuintas:docgen-v8

Conversation

@JCQuintas
Copy link
Copy Markdown
Member

@JCQuintas JCQuintas commented Jan 26, 2026

  • Remove unnecessary types
  • Small fixes for changes in v6, v7 and v8
  • Should support newer typescript
  • Most stuff done by claude
  • There is a lot of prop?. that are needed, we weren't taking that they were undefined before, current types should be better as they come from the lib
  • There is also an issue where the actual typedocs are duplicated if the props of an object are declared multiple times. hover on the prop value
    • This PR prevents it by displaying that in the propTypes/docs, so our devs are aware of it. A side-effect is that I had to "clean" some of the types in the code.
      1. ExtendButtonBaseTypeMap (ButtonBase.d.ts): Added dynamic Omit to exclude props that child types redefine
      2. ExtendPaperTypeMap (Paper.d.ts): Same pattern to prevent children and sx duplication in Accordion, AppBar, etc.
      3. ExtendListTypeMap (List.d.ts): Same pattern to prevent children duplication in MenuList
      4. StyledComponentProps (styles/index.d.ts): Removed JSDoc to prevent classes duplication
      5. TransitionProps (transitions/transition.ts): Defined addEndListener locally with JSDoc to avoid duplication from external react-transition-group types
      6. Select.d.ts:
      • Removed variant from BaseSelectProps (moved JSDoc to OutlinedSelectProps only)
      • Added 'defaultValue' | 'sx' to Omit in all variant interfaces
      1. TextField.d.ts: Restructured variant interfaces to use indexed access types for slots/slotProps without inheriting duplicate JSDoc
      2. AccordionSummary.d.ts: Added JSDoc to children prop since it was no longer inherited
      3. SwipeableDrawer.d.ts: Made SwipeableDrawerSlots extend DrawerSlots and used single CreateSlotsAndSlotProps to avoid duplicate slots/slotProps JSDoc

X changes mui/mui-x#21155

@JCQuintas JCQuintas self-assigned this Jan 26, 2026
@JCQuintas JCQuintas added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). labels Jan 26, 2026
@mui-bot
Copy link
Copy Markdown

mui-bot commented Jan 26, 2026

Netlify deploy preview

https://deploy-preview-47685--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 9da3f78

@JCQuintas JCQuintas marked this pull request as ready for review January 27, 2026 20:57
@JCQuintas JCQuintas requested a review from a team January 27, 2026 20:57
@JCQuintas
Copy link
Copy Markdown
Member Author

@mui/infra This is currently working, we might want to divide some of the changes to isolate them, as I took some liberty in the path I took.

I want to hear your opinion on this though, before I go further.

My main motivation was to fix an issue with satisfies usage in X 🫠

distinctDefinitions.set(definition.$$id, definition);
}
// Always update so that the last definition's jsDoc wins
// This ensures that when types are intersected (A & B), the last type's documentation is used
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.

So it went from first to last definition wins?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Pretty much

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reasoning was more that usually we have

interface A extends B {} which is similar to A & B. It felt a bit arbitrary that the first wins, which would prevent some overriding.

Ideally the best way is to Omit<A, keyof B> & B though

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.

interface A extends B {}

feels similar to

B & A

to me, as in A's props should win over Bs, but that isn't how this code interpretes it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

True, A should win in the first, but B should in the second. 🫠

I checked it on the playground

Inheritance picks the first time the prop appears 🙃
If you override it, then it ignores any previous declaration.

Intersection merges all declarations together.

Copy link
Copy Markdown
Member

@Janpot Janpot Jan 28, 2026

Choose a reason for hiding this comment

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

I think ideally we take interface behavior, because that can't simply be altered to fix the comment. i.e.

interface X extends Y, Z {
  /** foo */
  prop: number
}

we can easily move Y and Z around, but we can't really reorder X. even though, if one comment should win, it's probably X here.

For types, we can freely change the order, so it doesn't really matter what we do in terms of "first wins" or "last wins", we can pick what interfaces do and adjust order where needed.

Instead of adding more Omit, maybe it's a matter of reordering the types in the intersection?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've reworked it a bit to follow typescript, which required less changes in the end :)
Divided them into commits for each component, each with a vague-ish description of the reason 😆

In a few cases it still made sense to add Omit, else the types (when viewed by the user in a code editor) would still be merged/messy.

@Janpot
Copy link
Copy Markdown
Member

Janpot commented Jan 28, 2026

Took the liberty of removing a few more as any

@Janpot
Copy link
Copy Markdown
Member

Janpot commented Jan 28, 2026

Added dynamic Omit to exclude props that child types redefine

To me, the intuitive thing to do is that the comment on the prop of the overwrite wins, if there is one. Not sure if that's hard todo or not, but with that logic, do we really need to exclude props?

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Feb 18, 2026
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Feb 18, 2026
@JCQuintas JCQuintas requested a review from siriwatknp February 19, 2026 16:41
Copy link
Copy Markdown
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Feb 24, 2026
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Feb 24, 2026
@JCQuintas JCQuintas enabled auto-merge (squash) February 24, 2026 12:06
@JCQuintas JCQuintas merged commit 600ea84 into mui:master Feb 24, 2026
23 checks passed
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 16, 2026
…eclarations

The `getSymbolDocumentation` function was introduced in mui#47685 to handle
JSDoc merging across multiple TypeScript declarations. However, it
unconditionally joined all unique JSDoc comments when a symbol had
multiple declarations, which produced duplicated descriptions in the
generated propTypes for interface declaration merging and module
augmentation scenarios.

TypeScript treats JSDoc differently depending on how declarations
combine:

- Intersection types (type C = A & B): all constituent JSDoc are merged
- Interface extends (interface Z extends X, Y): first parent's JSDoc
wins
- Interface override (interface W extends X { prop }): the override's
JSDoc wins
- Declaration merging / module augmentation: last declaration's JSDoc
wins

The previous implementation treated all multi-declaration cases as
intersections, concatenating distinct comments. This caused issues in
downstream repos (e.g. mui-x) where module augmentation is used to
extend interface props — the original and augmented JSDoc would both
appear in the generated propTypes output.

The fix now uses `parentType.isIntersection()` to distinguish
intersection types (where merging is correct) from declaration merging
(where the last declaration should win), matching TypeScript's own
behavior.

Added test cases for all four JSDoc resolution scenarios:
- jsdoc-intersection: verifies both descriptions are merged
- jsdoc-interface-extends: verifies first parent's description wins
- jsdoc-interface-override: verifies override description wins
- declaration-merging: verifies last (augmented) description wins
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 16, 2026
…eclarations

The `getSymbolDocumentation` function was introduced in mui#47685 to handle
JSDoc merging across multiple TypeScript declarations. However, it
unconditionally joined all unique JSDoc comments when a symbol had
multiple declarations, which produced duplicated descriptions in the
generated propTypes for interface declaration merging and module
augmentation scenarios.

TypeScript treats JSDoc differently depending on how declarations
combine:

- Intersection types (type C = A & B): all constituent JSDoc are merged
- Interface extends (interface Z extends X, Y): first parent's JSDoc
wins
- Interface override (interface W extends X { prop }): the override's
JSDoc wins
- Declaration merging / module augmentation: last declaration's JSDoc
wins

The previous implementation treated all multi-declaration cases as
intersections, concatenating distinct comments. This caused issues in
downstream repos (e.g. mui-x) where module augmentation is used to
extend interface props — the original and augmented JSDoc would both
appear in the generated propTypes output.

The fix now uses `parentType.isIntersection()` to distinguish
intersection types (where merging is correct) from declaration merging
(where the last declaration should win), matching TypeScript's own
behavior.

Added test cases for all four JSDoc resolution scenarios:
- jsdoc-intersection: verifies both descriptions are merged
- jsdoc-interface-extends: verifies first parent's description wins
- jsdoc-interface-override: verifies override description wins
- declaration-merging: verifies last (augmented) description wins
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 16, 2026
…eclarations

The `getSymbolDocumentation` function was introduced in mui#47685 to handle
JSDoc merging across multiple TypeScript declarations. However, it
unconditionally joined all unique JSDoc comments when a symbol had
multiple declarations, which produced duplicated descriptions in the
generated propTypes for interface declaration merging and module
augmentation scenarios.

TypeScript treats JSDoc differently depending on how declarations
combine:

- Intersection types (type C = A & B): all constituent JSDoc are merged
- Interface extends (interface Z extends X, Y): first parent's JSDoc
wins
- Interface override (interface W extends X { prop }): the override's
JSDoc wins
- Declaration merging / module augmentation: last declaration's JSDoc
wins

The previous implementation treated all multi-declaration cases as
intersections, concatenating distinct comments. This caused issues in
downstream repos (e.g. mui-x) where module augmentation is used to
extend interface props — the original and augmented JSDoc would both
appear in the generated propTypes output.

The fix now uses `parentType.isIntersection()` to distinguish
intersection types (where merging is correct) from declaration merging
(where the last declaration should win), matching TypeScript's own
behavior.

Added test cases for all four JSDoc resolution scenarios:
- jsdoc-intersection: verifies both descriptions are merged
- jsdoc-interface-extends: verifies first parent's description wins
- jsdoc-interface-override: verifies override description wins
- declaration-merging: verifies last (augmented) description wins
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 16, 2026
…eclarations

The `getSymbolDocumentation` function was introduced in mui#47685 to handle
JSDoc merging across multiple TypeScript declarations. However, it
unconditionally joined all unique JSDoc comments when a symbol had
multiple declarations, which produced duplicated descriptions in the
generated propTypes for interface declaration merging, module
augmentation, and intersection type scenarios.

The previous implementation treated all multi-declaration cases as
intersections and concatenated distinct comments. This caused issues in
downstream repos (e.g. mui-x) where:
- Module augmentation extends interface props (e.g. BarPlotProps
onItemClick)
- Intersection types combine types with overridden JSDoc (e.g. autoFocus
  in MultiInputDateRangeField where the field-specific description
should replace the base HTML input description)

The fix uses a simple "last declaration wins" rule for all cases with
multiple declarations, consistent with `squashPropTypeDefinitions` which
already uses the same approach. This correctly handles:
- Declaration merging / module augmentation: augmentation wins
- Intersection types: last constituent wins
- Interface extends / override: override wins (single declaration)

Added test cases for all four JSDoc resolution scenarios:
- jsdoc-intersection: verifies last constituent's description wins
- jsdoc-interface-extends: verifies first parent's description wins
- jsdoc-interface-override: verifies override description wins
- declaration-merging: verifies last (augmented) description wins

This change has no affect on this repo and affects around 7
api/proptypes generation in X repo.
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 16, 2026
…eclarations

The `getSymbolDocumentation` function was introduced in mui#47685 to handle
JSDoc merging across multiple TypeScript declarations. However, it
unconditionally joined all unique JSDoc comments when a symbol had
multiple declarations, which produced duplicated descriptions in the
generated propTypes for interface declaration merging, module
augmentation, and intersection type scenarios.

The previous implementation treated all multi-declaration cases as
intersections and concatenated distinct comments. This caused issues in
downstream repos (e.g. mui-x) where:
- Module augmentation extends interface props (e.g. BarPlotProps
onItemClick)
- Intersection types combine types with overridden JSDoc (e.g. autoFocus
  in MultiInputDateRangeField where the field-specific description
should replace the base HTML input description)

The fix uses a simple "last declaration wins" rule for all cases with
multiple declarations, consistent with `squashPropTypeDefinitions` which
already uses the same approach. This correctly handles:
- Declaration merging / module augmentation: augmentation wins
- Intersection types: last constituent wins
- Interface extends / override: override wins (single declaration)

Added test cases for all four JSDoc resolution scenarios:
- jsdoc-intersection: verifies last constituent's description wins
- jsdoc-interface-extends: verifies first parent's description wins
- jsdoc-interface-override: verifies override description wins
- declaration-merging: verifies last (augmented) description wins

This change has no effect on this repo and affects around 7
api/proptypes generation in X repo.
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 16, 2026
…eclarations

The `getSymbolDocumentation` function was introduced in mui#47685 to handle
JSDoc merging across multiple TypeScript declarations. However, it
unconditionally joined all unique JSDoc comments when a symbol had
multiple declarations, which produced duplicated descriptions in the
generated propTypes for interface declaration merging, module
augmentation, and intersection type scenarios.

The previous implementation treated all multi-declaration cases as
intersections and concatenated distinct comments. This caused issues in
downstream repos (e.g. mui-x) where:
- Module augmentation extends interface props (e.g. BarPlotProps
onItemClick)
- Intersection types combine types with overridden JSDoc (e.g. autoFocus
  in MultiInputDateRangeField where the field-specific description
should replace the base HTML input description)

The fix uses a simple "last declaration wins" rule for all cases with
multiple declarations, consistent with `squashPropTypeDefinitions` which
already uses the same approach. This correctly handles:
- Declaration merging / module augmentation: augmentation wins
- Intersection types: last constituent wins
- Interface extends / override: override wins (single declaration)

Added test cases for all four JSDoc resolution scenarios:
- jsdoc-intersection: verifies last constituent's description wins
- jsdoc-interface-extends: verifies first parent's description wins
- jsdoc-interface-override: verifies override description wins
- declaration-merging: verifies last (augmented) description wins

This change has no effect on this repo and affects around 7
api/proptypes generation in X repo.
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 16, 2026
`getSymbolDocumentation` (introduced in mui#47685) concatenated JSDoc from
all declarations when a symbol had multiple (intersection, declaration
merging, module augmentation). This produced duplicated descriptions in
generated propTypes.

Fix: use "last declaration wins" for all multi-declaration cases,
consistent with `squashPropTypeDefinitions`.

Added tests for intersection, interface extends, interface override,
and declaration merging scenarios.

This change has no effect on this repo and affects around 7
api/proptypes generation in X repo.
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 16, 2026
`getSymbolDocumentation` (introduced in mui#47685) concatenated JSDoc from
all declarations when a symbol had multiple (intersection, declaration
merging, module augmentation). This produced duplicated descriptions in
generated propTypes.

Fix: use "last declaration wins" for all multi-declaration cases,
consistent with `squashPropTypeDefinitions`.

Added tests for intersection, interface extends, interface override,
and declaration merging scenarios.

This change has no effect on this repo and affects around 7
api/proptypes generation in X repo.
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 17, 2026
`getSymbolDocumentation` (introduced in mui#47685) concatenated JSDoc from
all declarations when a symbol had multiple (intersection, declaration
merging, module augmentation). This produced duplicated descriptions in
generated propTypes.

Fix: use "last declaration wins" for all multi-declaration cases,
consistent with `squashPropTypeDefinitions`.

Added tests for intersection, interface extends, interface override,
and declaration merging scenarios.

This change has no effect on this repo and affects around 7
api/proptypes generation in X repo.
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 17, 2026
`getSymbolDocumentation` (introduced in mui#47685) concatenated JSDoc from
all declarations when a symbol had multiple (intersection, declaration
merging, module augmentation). This produced duplicated descriptions in
generated propTypes.

Fix: use "last declaration wins" for all multi-declaration cases,
consistent with `squashPropTypeDefinitions`.

Added tests for intersection, interface extends, interface override,
and declaration merging scenarios.

This change has no effect on this repo and affects around 7
api/proptypes generation in X repo.
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 17, 2026
`getSymbolDocumentation` (introduced in mui#47685) concatenated JSDoc from
all declarations when a symbol had multiple (intersection, declaration
merging, module augmentation). This produced duplicated descriptions in
generated propTypes.

Fix: use "last declaration wins" for all multi-declaration cases,
consistent with `squashPropTypeDefinitions`.

Added tests for intersection, interface extends, interface override,
and declaration merging scenarios.

This change has no effect on this repo and affects around 7
api/proptypes generation in X repo.
brijeshb42 added a commit to brijeshb42/material-ui that referenced this pull request Apr 20, 2026
`getSymbolDocumentation` (introduced in mui#47685) concatenated JSDoc from
all declarations when a symbol had multiple (intersection, declaration
merging, module augmentation). This produced duplicated descriptions in
generated propTypes.

Fix: use "last declaration wins" for all multi-declaration cases,
consistent with `squashPropTypeDefinitions`.

Added tests for intersection, interface extends, interface override,
and declaration merging scenarios.

This change has no effect on this repo and affects around 7
api/proptypes generation in X repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants