From e2d00414b6cc7e8a931e136b39734388432d373a Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Tue, 31 Mar 2026 20:54:17 +0800 Subject: [PATCH 1/4] [all components] Fix `slotProps.transition` types (#48153) --- .../mui-material/src/Accordion/Accordion.d.ts | 2 +- .../src/Accordion/Accordion.spec.tsx | 10 ++++++++++ .../mui-material/src/Backdrop/Backdrop.d.ts | 2 +- .../src/Backdrop/Backdrop.spec.tsx | 10 ++++++++++ packages/mui-material/src/Dialog/Dialog.d.ts | 2 +- .../mui-material/src/Dialog/Dialog.spec.tsx | 10 +++++++++- packages/mui-material/src/Drawer/Drawer.d.ts | 2 +- .../mui-material/src/Drawer/Drawer.spec.tsx | 10 +++++++++- packages/mui-material/src/Menu/Menu.d.ts | 2 +- packages/mui-material/src/Menu/Menu.spec.tsx | 9 +++++++++ .../mui-material/src/Popover/Popover.d.ts | 2 +- .../mui-material/src/Popover/Popover.spec.tsx | 10 +++++++++- .../mui-material/src/Snackbar/Snackbar.d.ts | 2 +- .../src/Snackbar/Snackbar.spec.tsx | 8 ++++++++ .../mui-material/src/SpeedDial/SpeedDial.d.ts | 6 +++++- .../src/SpeedDial/SpeedDial.spec.tsx | 10 ++++++++++ .../src/StepContent/StepContent.d.ts | 6 +++++- .../src/StepContent/StepContent.spec.tsx | 20 ++++++++++++++----- .../mui-material/src/Tooltip/Tooltip.d.ts | 2 +- .../mui-material/src/Tooltip/Tooltip.spec.tsx | 11 ++++++++++ 20 files changed, 118 insertions(+), 18 deletions(-) create mode 100644 packages/mui-material/src/Backdrop/Backdrop.spec.tsx create mode 100644 packages/mui-material/src/SpeedDial/SpeedDial.spec.tsx diff --git a/packages/mui-material/src/Accordion/Accordion.d.ts b/packages/mui-material/src/Accordion/Accordion.d.ts index f75c327c213e05..11b564eb9cf570 100644 --- a/packages/mui-material/src/Accordion/Accordion.d.ts +++ b/packages/mui-material/src/Accordion/Accordion.d.ts @@ -58,7 +58,7 @@ export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component. */ transition: SlotComponentProps< - React.ElementType, + React.ElementType, TransitionProps & AccordionTransitionSlotPropsOverrides, AccordionOwnerState >; diff --git a/packages/mui-material/src/Accordion/Accordion.spec.tsx b/packages/mui-material/src/Accordion/Accordion.spec.tsx index cec6227e6d6865..6a6cdd8ca04f76 100644 --- a/packages/mui-material/src/Accordion/Accordion.spec.tsx +++ b/packages/mui-material/src/Accordion/Accordion.spec.tsx @@ -84,6 +84,16 @@ function Custom(props: AccordionProps) { ); } +// slotProps.transition should reject unknown props + +
+; + function Custom2(props: AccordionProps) { const { slotProps, ...other } = props; return ( diff --git a/packages/mui-material/src/Backdrop/Backdrop.d.ts b/packages/mui-material/src/Backdrop/Backdrop.d.ts index 87b892b4ce4676..3feb86cbfb4f96 100644 --- a/packages/mui-material/src/Backdrop/Backdrop.d.ts +++ b/packages/mui-material/src/Backdrop/Backdrop.d.ts @@ -37,7 +37,7 @@ export type BackdropSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Fade](https://mui.com/material-ui/api/fade/#props) component. */ transition: SlotComponentProps< - React.ElementType, + React.ElementType, TransitionProps & BackdropTransitionSlotPropsOverrides, BackdropOwnerState >; diff --git a/packages/mui-material/src/Backdrop/Backdrop.spec.tsx b/packages/mui-material/src/Backdrop/Backdrop.spec.tsx new file mode 100644 index 00000000000000..5c168958adf8f2 --- /dev/null +++ b/packages/mui-material/src/Backdrop/Backdrop.spec.tsx @@ -0,0 +1,10 @@ +import Backdrop from '@mui/material/Backdrop'; + +// slotProps.transition should reject unknown props +; diff --git a/packages/mui-material/src/Dialog/Dialog.d.ts b/packages/mui-material/src/Dialog/Dialog.d.ts index dcfc6242b1bf17..08e6a5e45b54fd 100644 --- a/packages/mui-material/src/Dialog/Dialog.d.ts +++ b/packages/mui-material/src/Dialog/Dialog.d.ts @@ -68,7 +68,7 @@ export type DialogSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Fade](https://mui.com/material-ui/api/fade/#props) component. */ transition: SlotComponentProps< - React.ElementType, + React.ElementType, TransitionProps & DialogTransitionSlotPropsOverrides, DialogOwnerState >; diff --git a/packages/mui-material/src/Dialog/Dialog.spec.tsx b/packages/mui-material/src/Dialog/Dialog.spec.tsx index afffde622784cc..3935f05c443d92 100644 --- a/packages/mui-material/src/Dialog/Dialog.spec.tsx +++ b/packages/mui-material/src/Dialog/Dialog.spec.tsx @@ -14,7 +14,15 @@ function Test() { return ( ; - ; + ; + + ; ); } diff --git a/packages/mui-material/src/Drawer/Drawer.d.ts b/packages/mui-material/src/Drawer/Drawer.d.ts index 429f4c0fb3d61f..e04a51d4fb7da1 100644 --- a/packages/mui-material/src/Drawer/Drawer.d.ts +++ b/packages/mui-material/src/Drawer/Drawer.d.ts @@ -85,7 +85,7 @@ export type DrawerSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Slide](https://mui.com/material-ui/api/slide/#props) component. */ transition: SlotProps< - React.ElementType, + React.ElementType, TransitionProps & DrawerTransitionSlotPropsOverrides, DrawerOwnerState >; diff --git a/packages/mui-material/src/Drawer/Drawer.spec.tsx b/packages/mui-material/src/Drawer/Drawer.spec.tsx index 5cf479fe793988..4dca793092dbd2 100644 --- a/packages/mui-material/src/Drawer/Drawer.spec.tsx +++ b/packages/mui-material/src/Drawer/Drawer.spec.tsx @@ -14,7 +14,15 @@ function Test() { return ( ; - ; + ; + + ; ); } diff --git a/packages/mui-material/src/Menu/Menu.d.ts b/packages/mui-material/src/Menu/Menu.d.ts index eddb23a7556da9..062aca01a212b0 100644 --- a/packages/mui-material/src/Menu/Menu.d.ts +++ b/packages/mui-material/src/Menu/Menu.d.ts @@ -73,7 +73,7 @@ export type MenuSlotsAndSlotProps = CreateSlotsAndSlotProps< */ transition: SlotComponentProps< // use SlotComponentProps because transition slot does not support `component` and `sx` prop - React.ElementType, + React.ElementType, TransitionProps & MenuTransitionSlotPropsOverrides, MenuOwnerState >; diff --git a/packages/mui-material/src/Menu/Menu.spec.tsx b/packages/mui-material/src/Menu/Menu.spec.tsx index bc89ea21695072..dda94ba771d490 100644 --- a/packages/mui-material/src/Menu/Menu.spec.tsx +++ b/packages/mui-material/src/Menu/Menu.spec.tsx @@ -1,5 +1,14 @@ import Menu, { MenuProps } from '@mui/material/Menu'; +// slotProps.transition should reject unknown props +; + , TransitionProps & PopoverTransitionSlotPropsOverrides, PopoverOwnerState >; diff --git a/packages/mui-material/src/Popover/Popover.spec.tsx b/packages/mui-material/src/Popover/Popover.spec.tsx index 7b578176ee5631..ad38e4bea0bb55 100644 --- a/packages/mui-material/src/Popover/Popover.spec.tsx +++ b/packages/mui-material/src/Popover/Popover.spec.tsx @@ -13,7 +13,15 @@ function Test() { return ( ; - + ; + + ; ); } diff --git a/packages/mui-material/src/Snackbar/Snackbar.d.ts b/packages/mui-material/src/Snackbar/Snackbar.d.ts index ba7d9369cb3a4d..bce5ae16aa4fe4 100644 --- a/packages/mui-material/src/Snackbar/Snackbar.d.ts +++ b/packages/mui-material/src/Snackbar/Snackbar.d.ts @@ -69,7 +69,7 @@ export type SnackbarSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the element is based on the [Grow](https://mui.com/material-ui/api/grow/#props) component. */ transition: SlotComponentProps< - React.ElementType, + React.ElementType, TransitionProps & SnackbarTransitionSlotPropsOverrides, SnackbarOwnerState >; diff --git a/packages/mui-material/src/Snackbar/Snackbar.spec.tsx b/packages/mui-material/src/Snackbar/Snackbar.spec.tsx index b058cdaf8ce14f..00fe458c1e8579 100644 --- a/packages/mui-material/src/Snackbar/Snackbar.spec.tsx +++ b/packages/mui-material/src/Snackbar/Snackbar.spec.tsx @@ -2,6 +2,14 @@ import { mergeSlotProps } from '@mui/material/utils'; import Snackbar, { SnackbarProps } from '@mui/material/Snackbar'; import { expectType } from '@mui/types'; +// slotProps.transition should reject unknown props +; + ; + transition: SlotComponentProps< + React.ElementType, + TransitionProps, + SpeedDialOwnerState + >; } >; diff --git a/packages/mui-material/src/SpeedDial/SpeedDial.spec.tsx b/packages/mui-material/src/SpeedDial/SpeedDial.spec.tsx new file mode 100644 index 00000000000000..10f232d2f4c126 --- /dev/null +++ b/packages/mui-material/src/SpeedDial/SpeedDial.spec.tsx @@ -0,0 +1,10 @@ +import SpeedDial from '@mui/material/SpeedDial'; + +// slotProps.transition should reject unknown props +; diff --git a/packages/mui-material/src/StepContent/StepContent.d.ts b/packages/mui-material/src/StepContent/StepContent.d.ts index 67ad8a83ac9bc8..3a60727c29f4b2 100644 --- a/packages/mui-material/src/StepContent/StepContent.d.ts +++ b/packages/mui-material/src/StepContent/StepContent.d.ts @@ -27,7 +27,11 @@ export type StepContentSlotsAndSlotProps = CreateSlotsAndSlotProps< * Props forwarded to the transition slot. * By default, the available props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component */ - transition: SlotComponentProps; + transition: SlotComponentProps< + React.ElementType, + CollapseProps, + StepContentOwnerState + >; } >; diff --git a/packages/mui-material/src/StepContent/StepContent.spec.tsx b/packages/mui-material/src/StepContent/StepContent.spec.tsx index 106d61cbde0539..f10eb5196944b3 100644 --- a/packages/mui-material/src/StepContent/StepContent.spec.tsx +++ b/packages/mui-material/src/StepContent/StepContent.spec.tsx @@ -7,11 +7,21 @@ import Grow from '@mui/material/Grow'; import Slide from '@mui/material/Slide'; import Zoom from '@mui/material/Zoom'; -Step Content; -Step Content; -Step Content; -Step Content; -Step Content; +// slotProps.transition should reject unknown props + + Step Content +; + +Step Content; +Step Content; +Step Content; +Step Content; +Step Content; function Custom(props: StepContentProps) { const { slotProps, ...other } = props; diff --git a/packages/mui-material/src/Tooltip/Tooltip.d.ts b/packages/mui-material/src/Tooltip/Tooltip.d.ts index f43a6196e638e6..0d265d06972640 100644 --- a/packages/mui-material/src/Tooltip/Tooltip.d.ts +++ b/packages/mui-material/src/Tooltip/Tooltip.d.ts @@ -56,7 +56,7 @@ export type TooltipSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Grow](https://mui.com/material-ui/api/grow/#props) component. */ transition: SlotProps< - React.ElementType, + React.ElementType, TransitionProps & TooltipTransitionSlotPropsOverrides, TooltipOwnerState >; diff --git a/packages/mui-material/src/Tooltip/Tooltip.spec.tsx b/packages/mui-material/src/Tooltip/Tooltip.spec.tsx index 93a3f3c9f7d58a..2b1ca33fc67a55 100644 --- a/packages/mui-material/src/Tooltip/Tooltip.spec.tsx +++ b/packages/mui-material/src/Tooltip/Tooltip.spec.tsx @@ -3,6 +3,17 @@ import { expectType } from '@mui/types'; import { mergeSlotProps } from '@mui/material/utils'; import Tooltip, { TooltipProps } from '@mui/material/Tooltip'; +// slotProps.transition should reject unknown props + + +; + ; From 04e315a030403328885aa6e38bdc7233069263d7 Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Thu, 2 Apr 2026 18:50:11 +0800 Subject: [PATCH 2/4] Fix types --- packages/mui-material/src/Drawer/Drawer.d.ts | 4 ++-- packages/mui-material/src/Drawer/Drawer.spec.tsx | 3 +++ packages/mui-material/src/Popover/Popover.d.ts | 5 +++-- packages/mui-material/src/Popover/Popover.spec.tsx | 3 ++- packages/mui-material/src/StepContent/StepContent.d.ts | 4 +--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/mui-material/src/Drawer/Drawer.d.ts b/packages/mui-material/src/Drawer/Drawer.d.ts index e04a51d4fb7da1..d063dd5239ca1e 100644 --- a/packages/mui-material/src/Drawer/Drawer.d.ts +++ b/packages/mui-material/src/Drawer/Drawer.d.ts @@ -85,8 +85,8 @@ export type DrawerSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Slide](https://mui.com/material-ui/api/slide/#props) component. */ transition: SlotProps< - React.ElementType, - TransitionProps & DrawerTransitionSlotPropsOverrides, + React.ElementType, + Omit & DrawerTransitionSlotPropsOverrides, DrawerOwnerState >; } diff --git a/packages/mui-material/src/Drawer/Drawer.spec.tsx b/packages/mui-material/src/Drawer/Drawer.spec.tsx index 4dca793092dbd2..e307bccc3a9338 100644 --- a/packages/mui-material/src/Drawer/Drawer.spec.tsx +++ b/packages/mui-material/src/Drawer/Drawer.spec.tsx @@ -15,6 +15,7 @@ function Test() { ; ; + ; , - TransitionProps & PopoverTransitionSlotPropsOverrides, + React.ElementType, + Omit & PopoverTransitionSlotPropsOverrides, PopoverOwnerState >; /** diff --git a/packages/mui-material/src/Popover/Popover.spec.tsx b/packages/mui-material/src/Popover/Popover.spec.tsx index ad38e4bea0bb55..5aa2f15e43d455 100644 --- a/packages/mui-material/src/Popover/Popover.spec.tsx +++ b/packages/mui-material/src/Popover/Popover.spec.tsx @@ -13,7 +13,8 @@ function Test() { return ( ; - ; + ; + ; | undefined } - > + | React.JSXElementConstructor }> | undefined; } From 58fc0c192ee6f0b12ddd8f6dd15a3d6a44c0c271 Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Thu, 2 Apr 2026 21:47:11 +0800 Subject: [PATCH 3/4] Revert "Fix types" This reverts commit 04e315a030403328885aa6e38bdc7233069263d7. --- packages/mui-material/src/Drawer/Drawer.d.ts | 4 ++-- packages/mui-material/src/Drawer/Drawer.spec.tsx | 3 --- packages/mui-material/src/Popover/Popover.d.ts | 5 ++--- packages/mui-material/src/Popover/Popover.spec.tsx | 3 +-- packages/mui-material/src/StepContent/StepContent.d.ts | 4 +++- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/mui-material/src/Drawer/Drawer.d.ts b/packages/mui-material/src/Drawer/Drawer.d.ts index d063dd5239ca1e..e04a51d4fb7da1 100644 --- a/packages/mui-material/src/Drawer/Drawer.d.ts +++ b/packages/mui-material/src/Drawer/Drawer.d.ts @@ -85,8 +85,8 @@ export type DrawerSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Slide](https://mui.com/material-ui/api/slide/#props) component. */ transition: SlotProps< - React.ElementType, - Omit & DrawerTransitionSlotPropsOverrides, + React.ElementType, + TransitionProps & DrawerTransitionSlotPropsOverrides, DrawerOwnerState >; } diff --git a/packages/mui-material/src/Drawer/Drawer.spec.tsx b/packages/mui-material/src/Drawer/Drawer.spec.tsx index e307bccc3a9338..4dca793092dbd2 100644 --- a/packages/mui-material/src/Drawer/Drawer.spec.tsx +++ b/packages/mui-material/src/Drawer/Drawer.spec.tsx @@ -15,7 +15,6 @@ function Test() { ; ; - ; , - Omit & PopoverTransitionSlotPropsOverrides, + React.ElementType, + TransitionProps & PopoverTransitionSlotPropsOverrides, PopoverOwnerState >; /** diff --git a/packages/mui-material/src/Popover/Popover.spec.tsx b/packages/mui-material/src/Popover/Popover.spec.tsx index 5aa2f15e43d455..ad38e4bea0bb55 100644 --- a/packages/mui-material/src/Popover/Popover.spec.tsx +++ b/packages/mui-material/src/Popover/Popover.spec.tsx @@ -13,8 +13,7 @@ function Test() { return ( ; - ; - ; + ; }> + | React.JSXElementConstructor< + TransitionProps & { children?: React.ReactElement | undefined } + > | undefined; } From 8132d456a6b0a452f785da479be385a4a091ddc5 Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Thu, 2 Apr 2026 22:29:56 +0800 Subject: [PATCH 4/4] fix --- packages/mui-material/src/Drawer/Drawer.d.ts | 4 ++-- packages/mui-material/src/Drawer/Drawer.spec.tsx | 3 +++ packages/mui-material/src/Popover/Popover.d.ts | 5 +++-- packages/mui-material/src/Popover/Popover.spec.tsx | 3 ++- packages/mui-material/src/StepContent/StepContent.d.ts | 4 +--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/mui-material/src/Drawer/Drawer.d.ts b/packages/mui-material/src/Drawer/Drawer.d.ts index e04a51d4fb7da1..d063dd5239ca1e 100644 --- a/packages/mui-material/src/Drawer/Drawer.d.ts +++ b/packages/mui-material/src/Drawer/Drawer.d.ts @@ -85,8 +85,8 @@ export type DrawerSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Slide](https://mui.com/material-ui/api/slide/#props) component. */ transition: SlotProps< - React.ElementType, - TransitionProps & DrawerTransitionSlotPropsOverrides, + React.ElementType, + Omit & DrawerTransitionSlotPropsOverrides, DrawerOwnerState >; } diff --git a/packages/mui-material/src/Drawer/Drawer.spec.tsx b/packages/mui-material/src/Drawer/Drawer.spec.tsx index 4dca793092dbd2..e307bccc3a9338 100644 --- a/packages/mui-material/src/Drawer/Drawer.spec.tsx +++ b/packages/mui-material/src/Drawer/Drawer.spec.tsx @@ -15,6 +15,7 @@ function Test() { ; ; + ; , - TransitionProps & PopoverTransitionSlotPropsOverrides, + React.ElementType, + Omit & PopoverTransitionSlotPropsOverrides, PopoverOwnerState >; /** diff --git a/packages/mui-material/src/Popover/Popover.spec.tsx b/packages/mui-material/src/Popover/Popover.spec.tsx index ad38e4bea0bb55..5aa2f15e43d455 100644 --- a/packages/mui-material/src/Popover/Popover.spec.tsx +++ b/packages/mui-material/src/Popover/Popover.spec.tsx @@ -13,7 +13,8 @@ function Test() { return ( ; - ; + ; + ; | undefined } - > + | React.JSXElementConstructor }> | undefined; }