Repository navigation
Conversation
Move the generic API docs tooling out of mui#48823. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploy previewBundle size
PerformanceNo regressions in 32 benchmarks · precise to ±8.7% (±12.9% at worst) · ran 3m 50s · details Check out the code infra dashboard for more information about this PR. |
Intersections and mapped types can remove `null` or `undefined` from a prop declaration. Read them from the resolved prop type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LukasTy
marked this pull request as ready for review
December 3, 2026 15:42
LukasTy
requested review from
Janpot,
brijeshb42 and
siriwatknp
and
a balanced review from Copilot
December 3, 2026 15:42
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the API documentation tooling changes.
No open issues 🎉
What changed in this PR
Prepares Material UI’s API documentation tooling for subpath-only components, supporting Menu v2 in #48823 and correcting existing Pigment documentation.
Changes:
- Resolves subpath-only components and generates imports based on package exports.
- Supports digit-containing component names, import aliases, and generic class props.
- Preserves React union types and nullability in generated PropTypes, with regression fixtures.
| File | Description |
|---|---|
| packages-internal/scripts/typescript-to-proptypes/test/nullable-react-types/output.js | Expected nullable React validators. |
| packages-internal/scripts/typescript-to-proptypes/test/nullable-react-types/input.d.ts | Nullable React type fixtures. |
| packages-internal/scripts/typescript-to-proptypes/test/narrowed-react-types/output.js | Expected required validators after narrowing. |
| packages-internal/scripts/typescript-to-proptypes/test/narrowed-react-types/input.d.ts | Intersection and mapped-type fixtures. |
| packages-internal/scripts/typescript-to-proptypes/test/mixed-react-types/output.js | Expected mixed-union validators. |
| packages-internal/scripts/typescript-to-proptypes/test/mixed-react-types/input.d.ts | Mixed React union fixtures. |
| packages-internal/scripts/typescript-to-proptypes/src/getTypeHash.ts | Distinguishes element validator kinds. |
| packages-internal/scripts/typescript-to-proptypes/src/getPropTypesFromFile.ts | Preserves React unions and resolved nullability. |
| packages-internal/api-docs-builder/src/utils/parseSlotsAndClasses.ts | Reads instantiated class prop types. |
| packages-internal/api-docs-builder/src/utils/parseSlotsAndClasses.test.ts | Tests generic and local class extraction. |
| packages-internal/api-docs-builder/src/utils/getComponentTypeScriptProject.ts | Resolves component-local exports. |
| packages-internal/api-docs-builder/src/utils/getComponentTypeScriptProject.test.ts | Tests resolution and shared-project isolation. |
| packages-internal/api-docs-builder/src/utils/getComponentImports.ts | Generates export-aware import examples. |
| packages-internal/api-docs-builder/src/utils/getComponentImports.test.ts | Tests import paths and aliases. |
| packages-internal/api-docs-builder/src/utils/findComponents.ts | Accepts digits and anchors file extensions. |
| packages-internal/api-docs-builder/src/utils/findComponents.test.ts | Tests filename filtering and nested discovery. |
| packages-internal/api-docs-builder/src/utils/createTypeScriptProject.ts | Removes an obsolete Pigment entry-point example. |
| packages-internal/api-docs-builder/src/types/utils.types.ts | Adds optional local import names. |
| packages-internal/api-docs-builder/src/ApiBuilders/ComponentApiBuilder.ts | Integrates import and component-resolution helpers. |
| packages-internal/api-docs-builder-core/materialUi/projectSettings.ts | Simplifies entry points and maps PigmentContainer classes. |
| docs/translations/api-docs/pigment-container/pigment-container.json | Adds class descriptions. |
| docs/pages/material-ui/api/pigment-stack.json | Removes the invalid package-root import. |
| docs/pages/material-ui/api/pigment-grid.json | Removes the invalid package-root import. |
| docs/pages/material-ui/api/pigment-container.json | Corrects imports and documents MuiContainer classes. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#48823 (Menu2) needs this API docs tooling. This PR moves the generic part out of that PR for a separate review. The Menu2 PR stays open, and gets a merge of master after this PR merges.
Changes
api-docs-builderresolves a component that has only a subpath export from its own file. Before, the Pigment components had to be extra entry points of thematerialproject.@mui/materialimports from the PigmentContainer, PigmentGrid, and PigmentStack API pages.MuiContainerclasses.findComponentsaccepts digits in all parts of a component file name, not only a trailing2. The file name must end in.jsor.tsx.parseSlotsAndClassesreads the instantiated type of theclassesprop, so a genericclassesprop works.ComponentInfogets an optionalimportName, the local name in import examples. The Menu2 PR sets it.typescript-to-proptypespreservesnullin React element-type unions, for slots that acceptnull. It takesnullandundefinedfrom the resolved prop type. A prop that an intersection or a mapped type narrows stays required.Impact
pnpm docs:api: only the 3 Pigment API pages and the PigmentContainer translations change.pnpm proptypes: no changes.Generated with Claude Code