Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Use boolean type for ListItem prop instead of 'false' #23338

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/material-ui/src/ListItem/ListItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,30 +98,30 @@ export interface ListItemTypeMap<P, D extends React.ElementType> {
*
* - [ListItem API](https://material-ui.com/api/list-item/)
*/
declare const ListItem: OverridableComponent<
declare const ListItem: ExtendButtonBase<
ListItemTypeMap<
{
/**
* If `true`, the list item is a button (using `ButtonBase`). Props intended
* for `ButtonBase` can then be applied to `ListItem`.
* @default false
*/
button?: false;
button: true;
},
'li'
'div'
>
> &
ExtendButtonBase<
OverridableComponent<
ListItemTypeMap<
{
/**
* If `true`, the list item is a button (using `ButtonBase`). Props intended
* for `ButtonBase` can then be applied to `ListItem`.
* @default false
*/
button: true;
button?: boolean;
},
'div'
'li'
>
>;

Expand Down
1 change: 0 additions & 1 deletion packages/material-ui/src/ListItem/ListItem.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ function BooleanButtonTest() {

function EditableItemFail(props: { editable: boolean }) {
const { editable } = props;
// @ts-expect-error 'boolean' is not assignable to type 'true'
return <ListItem button={editable}>Editable? {editable}</ListItem>;
}

Expand Down