Skip to content

[core-docs] Annotate createMaterialTemplate return types for typescript@next - #49453

Closed
github-actions[bot] wants to merge 1 commit into
masterfrom
ci-flake-fix/20261013-080001
Closed

github-actions[bot] wants to merge 1 commit into
masterfrom
ci-flake-fix/20261013-080001

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

What breaks

The nightly test_types_next job (TypeScript next) has failed on every nightly run for the past 7 days (2026-10-07 → 2026-10-13). Building the declaration files for @mui/internal-core-docs fails:

src/Demo/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.
src/Demo/sandbox/StackBlitz.ts  - error TS5088: (same)

Last occurrence: https://app.circleci.com/pipelines/github/mui/material-ui/183506/workflows/aa5a8ba7-bd11-4d63-926b-e0f54da3f21c

Why it started failing

This was not caused by a change in our code. The nightly job installs typescript@next, which is a moving channel. createMaterialTemplate returns an object literal whose replaceContent() method does return this, so the inferred return type refers to itself. Stable TypeScript quietly emits replaceContent(...): /*elided*/ any in the .d.ts. typescript@7.1.0-dev now reports TS5088 and asks for an explicit annotation. I reproduced this with a minimal file: typescript@7.1.0-dev.20261012.1 errors, and the older compiler emits /*elided*/ any.

The fix

Add an explicit MaterialTemplate return type to createMaterialTemplate in both the CodeSandbox and StackBlitz helpers. replaceContent() returns MaterialTemplate, so the emitted declarations get a real type instead of any, and chaining .createMaterialTemplate(...).replaceContent(...).openSandbox() in the docs keeps working. I updated both copies of the helpers (src/Demo/sandbox/ and src/sandbox/) because they have identical code and are both part of the src/** declaration build. Runtime behavior does not change.

Verification

  • Compiled the four changed files with typescript@next (7.1.0-dev.20261012.1) in a standalone setup. TS5088 is gone, there are no new type errors, and the emitted .d.ts contains the MaterialTemplate interface. The only errors left were about process missing, which comes from that setup not loading node types.
  • I did not run the full monorepo pnpm lerna run build / typescript:ci locally. CI on this PR covers stable TS. The nightly test_types_next run will confirm the fix with TS next.

🤖 Generated with Claude Code

cc @mui/infra


Opened by a sandboxed agent. Unverified beyond any local check noted above; CI on this PR is the real test.

@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 13, 2026
@github-actions github-actions Bot mentioned this pull request Oct 13, 2026
@code-infra-dashboard

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49453--material-ui.netlify.app/
QR code for https://deploy-preview-49453--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.

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 21, 2026
@ZeeshanTamboli

Copy link
Copy Markdown
Member

Resolved in #49497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-flake-fix PR: out-of-date The pull request has merge conflicts and can't be merged. 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.

1 participant