Updated PassingSxProp.js example for better compatibility with TypeSсript by LeusMaximus · Pull Request #49083 · mui/material-ui · GitHub
Skip to content

Updated PassingSxProp.js example for better compatibility with TypeSсript - #49083

Open
LeusMaximus wants to merge 2 commits into
mui:masterfrom
LeusMaximus:patch-1
Open

Updated PassingSxProp.js example for better compatibility with TypeSсript#49083
LeusMaximus wants to merge 2 commits into
mui:masterfrom
LeusMaximus:patch-1

Conversation

@LeusMaximus

@LeusMaximus LeusMaximus commented Sep 3, 2026

Copy link
Copy Markdown

When we use ...(Array.isArray(sx) ? sx : [sx]), example with TypeScript we got an ESLint error: Unsafe spread of an any value in an array. (@typescript-eslint/no-unsafe-assignment)

See issue #37730

Solution with .flat() eliminates this problem.

@code-infra-dashboard

code-infra-dashboard Bot commented Sep 3, 2026

Copy link
Copy Markdown

@LeusMaximus
LeusMaximus force-pushed the patch-1 branch 2 times, most recently from c5d5eed to 055cbc8 Compare September 3, 2026 14:37
@zannager zannager added typescript docs Improvements or additions to the documentation. scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI labels Sep 3, 2026
@zannager
zannager requested a review from siriwatknp September 3, 2026 15:28
@LeusMaximus
LeusMaximus force-pushed the patch-1 branch 2 times, most recently from 664f64e to 91794f5 Compare September 4, 2026 14:04
…ript

When we use `...(Array.isArray(sx) ? sx : [sx]),` example with TypeScript we got an ESLint error:
`Unsafe spread of an any value in an array. (@typescript-eslint/no-unsafe-assignment)`

See issue mui#37730

Solution with `.flat()` eliminates this problem.

Signed-off-by: Maksym <leus.maximus@gmail.com>
Signed-off-by: Maksym <leus.maximus@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants