Update IconButton's loading
prop type to match Button's
#45048
Labels
status: waiting for maintainer
These issues haven't been looked at yet by a maintainer
Steps to reproduce
Steps:
Current behavior
When passing in props with the type
ButtonProp
intoIconButton
we get this TS error becauseloading
prop inButtonProps
has the typeboolean | null | undefined
andloading
prop inIconButtonProps
has the typeboolean | undefined
Expected behavior
loading
prop inIconButtonProps
andButtonProps
should match so we can avoid this typescript error.Context
In my code, I'm doing something like this:
Where
IconButton
is rendered if icon is present, else renderButton
. I want to passButtonProps
intoIconButton
along withIconButtonProps
, but I get a typescript error becauseloading
prop is typed differently. The change that caused this error was implemented here: https://github.com/mui/material-ui/pull/44637/files#diff-cd39c5645f09c072c657b0bd6c2a1036b3ed36c513e0ce75a22c3522ff060592R54Your environment
System:
OS: macOS 14.5
Binaries:
Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
pnpm: 8.15.2 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 132.0.6834.84
Edge: Not Found
Safari: 17.5
npmPackages:
@emotion/react: 11.14.0 => 11.14.0
@emotion/styled: 11.14.0 => 11.14.0
@mui/core-downloads-tracker: 6.4.0
@mui/icons-material: 6.4.0 => 6.4.0
@mui/material: 6.4.0 => 6.4.0
@mui/private-theming: 6.4.0
@mui/styled-engine: 6.4.0
@mui/system: 6.4.0 => 6.4.0
@mui/types: 7.2.21
@mui/utils: 6.4.0 => 6.4.0
@mui/x-date-pickers: 7.23.6 => 7.23.6
@mui/x-internals: 7.23.6
@types/react: 18.3.18 => 18.3.18
react: 18.3.1 => 18.3.1
react-dom: 18.3.1 => 18.3.1
typescript: 5.7.3 => 5.7.3
My tsconfig:
Search keywords: loading prop
The text was updated successfully, but these errors were encountered: