Typescript error when passing forwardRef
components to MUI slots
#44952
Labels
bug 🐛
Something doesn't work
component: stepper
This is the name of the generic UI component, not the React module!
component: tooltip
This is the name of the generic UI component, not the React module!
typescript
Steps to reproduce
Steps:
Current behavior
Expected behavior
Same constructions worked in material@5
Default components itself wrapped in
forwardRef
so I would expect this wrapping be acceptable.From MUI source code:
Context
After upgrade to material@6 typescript complains about components that was wrapped in
forwardRef
being passed to slot props, both deprecated one, like:StepIconComponent={xxx}
, and new one, like:slots={{ stepIcon: xxx }}
.Seems to be only applicable for slots that have
React.ElementType
with arguments, like:React.ElementType<StepIconProps>;
. Slots without them works fine, most likely because this argument becomesany
by default.Tested with
StepLabel
andTooltip
components.Your environment
npx @mui/envinfo
Search keywords: types, typescript, ref, forward, slot
The text was updated successfully, but these errors were encountered: