Repository navigation
[core-docs] Remove duplicate Demo/sandbox and annotate createMaterialTemplate for TS 7 - #49497
Merged
Merged
Conversation
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
Janpot
marked this pull request as ready for review
October 19, 2026 15:15
aarongarciah
approved these changes
Oct 21, 2026
aarongarciah
left a comment
Member
There was a problem hiding this comment.
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@nextand 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, thereplaceContentupdater is typed to returnstring, butpackage.jsoncontent is an object and the docs callers return it unchanged, sostring | Record<string, any>would be accurate. InStackBlitz.tsfiles are always strings, so the parameter could just bestring. Pre-existing, but the new interface makes it explicit.
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.
The nightly
test_types_nextjob (TypeScript@next) fails while building declarations for@mui/internal-core-docs:createMaterialTemplatereturns an object whosereplaceContent()doesreturn this, so the inferred type contains itself. TypeScript 6 silently turned the recursion intoanyin the emitted.d.ts. TypeScript 7 asks for an explicit annotation instead. This PR adds aMaterialTemplatereturn type inCodeSandbox.tsandStackBlitz.ts, so chainedreplaceContent()calls also stay typed.The error showed up four times because
src/Demo/sandboxwas a near-copy ofsrc/sandbox, left over from #48842. The copies had already drifted: theDemoone still used thelatestnpm tag instead ofnextand missed the vite pin for stackblitz/webcontainer-core#2104. This PR deletessrc/Demo/sandbox, movesMuiChat.tsintosrc/sandbox, and pointsDemoat it. As a result, "Open in CodeSandbox/StackBlitz" on demos now gets@mui/material@nextand the pinned vite, the same as the templates.The separate
test_types_nextTS2883 errors (MUIStyledCommonProps) are not addressed here.