diff --git a/packages/mui-material/src/Alert/Alert.d.ts b/packages/mui-material/src/Alert/Alert.d.ts index e69909af38ac95..8ff5a1a81e579d 100644 --- a/packages/mui-material/src/Alert/Alert.d.ts +++ b/packages/mui-material/src/Alert/Alert.d.ts @@ -9,8 +9,9 @@ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types'; export type AlertColor = 'success' | 'info' | 'warning' | 'error'; export interface AlertPropsVariantOverrides {} - export interface AlertPropsColorOverrides {} +export interface AlertCloseButtonSlotPropsOverrides {} +export interface AlertCloseIconSlotPropsOverrides {} export interface AlertSlots { /** @@ -28,8 +29,16 @@ export interface AlertSlots { export type AlertSlotsAndSlotProps = CreateSlotsAndSlotProps< AlertSlots, { - closeButton: SlotProps, {}, AlertOwnerState>; - closeIcon: SlotProps, {}, AlertOwnerState>; + closeButton: SlotProps< + React.ElementType, + AlertCloseButtonSlotPropsOverrides, + AlertOwnerState + >; + closeIcon: SlotProps< + React.ElementType, + AlertCloseIconSlotPropsOverrides, + AlertOwnerState + >; } >; diff --git a/packages/mui-material/test/typescript/moduleAugmentation/alertCustomSlotProps.spec.tsx b/packages/mui-material/test/typescript/moduleAugmentation/alertCustomSlotProps.spec.tsx new file mode 100644 index 00000000000000..e18c5f41e6944b --- /dev/null +++ b/packages/mui-material/test/typescript/moduleAugmentation/alertCustomSlotProps.spec.tsx @@ -0,0 +1,44 @@ +import * as React from 'react'; +import Alert from '@mui/material/Alert'; +import { IconButton, IconButtonProps, svgIconClasses } from '@mui/material'; + +declare module '@mui/material/Alert' { + interface AlertCloseButtonSlotPropsOverrides { + iconSize: 'small' | 'medium'; + } +} + +type MyIconButtonProps = IconButtonProps< + 'button', + { + iconSize?: 'small' | 'medium'; + } +>; + +const MyIconButton = ({ iconSize, ...rest }: MyIconButtonProps) => { + return ( + + ); +}; + + + Here is a gentle confirmation that your action was successful. +; diff --git a/packages/mui-material/test/typescript/moduleAugmentation/alertCustomSlotProps.tsconfig.json b/packages/mui-material/test/typescript/moduleAugmentation/alertCustomSlotProps.tsconfig.json new file mode 100644 index 00000000000000..0775c50197bb43 --- /dev/null +++ b/packages/mui-material/test/typescript/moduleAugmentation/alertCustomSlotProps.tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../../../../tsconfig.json", + "files": ["alertCustomSlotProps.spec.tsx"] +}