Skip to content

[core-docs] Remove duplicate Demo/sandbox and annotate createMaterialTemplate for TS 7 - #49497

Merged
Janpot merged 3 commits into
masterfrom
ci-flake-fix/20261019-073824
Oct 21, 2026
Merged

Janpot merged 3 commits into
masterfrom
ci-flake-fix/20261019-073824

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

The nightly test_types_next job (TypeScript @next) fails while building declarations for @mui/internal-core-docs:

src/sandbox/CodeSandbox.ts: error TS5088: The inferred type of 'createMaterialTemplate' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary.

createMaterialTemplate returns an object whose replaceContent() does return this, so the inferred type contains itself. TypeScript 6 silently turned the recursion into any in the emitted .d.ts. TypeScript 7 asks for an explicit annotation instead. This PR adds a MaterialTemplate return type in CodeSandbox.ts and StackBlitz.ts, so chained replaceContent() calls also stay typed.

The error showed up four times because src/Demo/sandbox was a near-copy of src/sandbox, left over from #48842. The copies had already drifted: the Demo one still used the latest npm tag instead of next and missed the vite pin for stackblitz/webcontainer-core#2104. This PR deletes src/Demo/sandbox, moves MuiChat.ts into src/sandbox, and points Demo at it. As a result, "Open in CodeSandbox/StackBlitz" on demos now gets @mui/material@next and the pinned vite, the same as the templates.

The separate test_types_next TS2883 errors (MUIStyledCommonProps) are not addressed here.

@github-actions github-actions Bot added ci-flake-fix scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). type: regression A bug, but worse, it used to behave as expected. labels Oct 19, 2026
@github-actions github-actions Bot mentioned this pull request Oct 19, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49497--material-ui.netlify.app/
QR code for https://deploy-preview-49497--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 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


Check out the code infra dashboard for more information about this PR.

@Janpot
Janpot marked this pull request as ready for review October 19, 2026 15:15
@Janpot
Janpot requested review from a team October 19, 2026 15:16

@aarongarciah aarongarciah 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.

Verified locally: with typescript@next (7.1.0-dev) the base commit emits 4× TS5088 and this branch emits none. Core-docs vitest and eslint pass. The deleted Demo/sandbox only differed from sandbox by the next tag and the vite pin that #48842 accidentally reverted, so nothing is lost, and Demo/index.ts keeps the codeSandbox/stackBlitz re-exports.

Non-blocking nits:

  • The title undersells the second commit: "Open in CodeSandbox/StackBlitz" on demos now gets @mui/material@next and the pinned vite. Something like "[core-docs] Remove duplicate Demo/sandbox and annotate createMaterialTemplate for TS 7" would read better in the changelog.
  • In CodeSandbox.ts, the replaceContent updater is typed to return string, but package.json content is an object and the docs callers return it unchanged, so string | Record<string, any> would be accurate. In StackBlitz.ts files are always strings, so the parameter could just be string. Pre-existing, but the new interface makes it explicit.

@Janpot Janpot changed the title [core-docs] Annotate createMaterialTemplate return type for TypeScript 7 [core-docs] Remove duplicate Demo/sandbox and annotate createMaterialTemplate for TS 7 Oct 21, 2026
@Janpot
Janpot merged commit 9b5bd2b into master Oct 21, 2026
22 checks passed
@Janpot
Janpot deleted the ci-flake-fix/20261019-073824 branch October 21, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-flake-fix scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). type: regression A bug, but worse, it used to behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants