Repository navigation
[core-docs] Annotate createMaterialTemplate return types for typescript@next - #49453
Closed
github-actions[bot] wants to merge 1 commit into
Closed
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
Member
|
Resolved in #49497 |
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.
What breaks
The nightly
test_types_nextjob (TypeScriptnext) 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-docsfails: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.createMaterialTemplatereturns an object literal whosereplaceContent()method doesreturn this, so the inferred return type refers to itself. Stable TypeScript quietly emitsreplaceContent(...): /*elided*/ anyin the.d.ts.typescript@7.1.0-devnow reports TS5088 and asks for an explicit annotation. I reproduced this with a minimal file:typescript@7.1.0-dev.20261012.1errors, and the older compiler emits/*elided*/ any.The fix
Add an explicit
MaterialTemplatereturn type tocreateMaterialTemplatein both the CodeSandbox and StackBlitz helpers.replaceContent()returnsMaterialTemplate, so the emitted declarations get a real type instead ofany, and chaining.createMaterialTemplate(...).replaceContent(...).openSandbox()in the docs keeps working. I updated both copies of the helpers (src/Demo/sandbox/andsrc/sandbox/) because they have identical code and are both part of thesrc/**declaration build. Runtime behavior does not change.Verification
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.tscontains theMaterialTemplateinterface. The only errors left were aboutprocessmissing, which comes from that setup not loading node types.pnpm lerna run build/typescript:cilocally. CI on this PR covers stable TS. The nightlytest_types_nextrun will confirm the fix with TSnext.🤖 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.