Setting disableRipple on ListItem customization theme will throw a Typescript error
See original GitHub issueHi!
I am trying to disable the ripple effect globally on a ListItem
that uses a Button
as a list item, through the createMuiTheme.props
. I’m using React, Typescript, and Material UI.
createMuiTheme({
props: {
MuiListItem: {
disableRipple: true,
disableTouchRipple: true
}
}
})
Typescript will throw the following error:
Types of property ‘MuiListItem’ are incompatible. Type ‘{ disableRipple: boolean; disableTouchRipple: boolean; disableFocusRibble: boolean; }’ has no properties in common with type ‘Partial<OverrideProps<ListItemTypeMap<{}, “li”>, “li”>>’.ts(2322)
What is the proper way to set this up?
Here is a code sandbox showing the type error: ~https://codesandbox.io/s/using-buttonbase-props-in-muilistitem-default-props-v7fjb?file=/src/App.tsx~ https://codesandbox.io/s/using-buttonbase-props-in-muilistitem-default-props-forked-6jdnx
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to resolve typescript errors in custom theme in Material UI ...
But we are getting typescript error due to custom properties as following picture. Is it any way to define the type for custom...
Read more >Changing list component's disableRipple input does ... - GitHub
Setting disableRipple input of mat-nav-list or mat-action-list should prevent child mat-list-item 's from having a ripple effect when they ...
Read more >mui/material/CHANGELOG.md - UNPKG
13 -->[Avatar] Fix TypeScript error on imgProps (#30255) @ahmad-reza619 ... 580, - [IconButton] Remove on hover effect when `disableRipple` is set (#29298) ...
Read more >@material/mwc-list | Yarn - Package Manager
Fixed bug where setting the <mwc-snackbar> labelText property could throw an exception and fail to render (#412). Buttons slotted into <mwc-snackbar> now render ......
Read more >Design Patterns with React Easy State | by Bertalan Miklos
If set to 0 (default) a\\n * timeout is not created. ... errors are hidden from us by the browser\\n \u002F\u002F onerror should...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@eps1lon I’ve added a sandbox and removed the one invalid prop (
disableFocusRipple
) from the initial issue text. The gist of the problem is that Typescript complains when specifying ButtonBase props within the MuiListItem portion of the theme props.Here’s the related StackOverflow question (presumably from the same person): https://stackoverflow.com/questions/65274453/overwrite-material-ui-prop-types.
So are any other props for a specific
component
. It sounds like a niche case and considering the first time I see it, TypeScript actually prevented a mistake, it’s probably safer to let people trip over it first.