Closed eliprand closed 1 week ago
I found a TypeScript bug, will open a PR soon.
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
[!NOTE] We value your feedback @eliprand! How was your experience with our support team? If you could spare a moment, we'd love to hear your thoughts in this brief Support Satisfaction survey. Your insights help us improve!
It looks like #43523 went out in v6.0.2, but updating @mui/material
to v6.0.2 in the stackblitz above doesn't solve the type error.
I'm also still seeing the issue in a local project using v6.0.2.
It also doesn't matter if it's a slot or sx prop directly on a component, nor if you use sx={(theme) => ...}
or sx={{ someProperty: (theme) => ... }}
.
EDIT
The type error happens with TS v5.5.4 but not older v5.4.5, and it also happens with v5.5.4 in @mui/material
v5.16.7
Steps to reproduce
Link to live example: https://stackblitz.com/edit/react-1rixxg?file=Demo.tsx
Steps:
Popover
)sx
property of a slot (I usepaper
)t
as the theme prop)Current behavior
Here is the
Popover
example from the docs.TypeScript will complain about the type of
t
in thesx
prop for thepaper
slot:But the code runs just fine, as expected.
Expected behavior
TypeScript should recognize a theme-based override and not complain.
Context
Trying to override properties of a slot with theme-based values.
Your environment
``` System: OS: macOS 14.6.1 Binaries: Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm pnpm: Not Found Browsers: Chrome: 128.0.6613.114 Edge: 128.0.2739.42 Safari: 17.6 npmPackages: @emotion/react: ^11.13.3 => 11.13.3 @emotion/styled: ^11.13.0 => 11.13.0 @mui/base: 5.0.0-beta.58 @mui/core-downloads-tracker: 6.0.1 @mui/icons-material: ^6.0.1 => 6.0.1 @mui/lab: ^6.0.0-beta.8 => 6.0.0-beta.8 @mui/material: ^6.0.1 => 6.0.1 @mui/private-theming: 6.0.1 @mui/styled-engine: 6.0.1 @mui/system: 6.0.1 @mui/types: 7.2.16 @mui/utils: 5.16.6 @mui/x-data-grid: 7.15.0 @mui/x-data-grid-pro: ^7.15.0 => 7.15.0 @mui/x-date-pickers: 7.15.0 @mui/x-date-pickers-pro: ^7.15.0 => 7.15.0 @mui/x-internals: 7.15.0 @mui/x-license: 7.15.0 @types/react: ^18.3.4 => 18.3.4 react: ^18.3.1 => 18.3.1 react-dom: ^18.3.1 => 18.3.1 typescript: ^5.5.4 => 5.5.4 ```npx @mui/envinfo
Search keywords: slotprops sx