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

ListItem button props set to hard true. #22402

Closed
2 tasks done
AhmedBHameed opened this issue Aug 29, 2020 · 1 comment
Closed
2 tasks done

ListItem button props set to hard true. #22402

AhmedBHameed opened this issue Aug 29, 2020 · 1 comment
Labels
component: list This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists typescript

Comments

@AhmedBHameed
Copy link

AhmedBHameed commented Aug 29, 2020

Current Behavior 😯

Looking to ListItem type definition in the following path *node_modules/@material-ui/core/ListItem/ListItem.d.ts, I find button property taking type of true.

declare const ListItem: OverridableComponent<ListItemTypeMap<{ button?: false }, 'li'>> &
  ExtendButtonBase<ListItemTypeMap<{ button: true }, 'div'>>;

Expected Behavior 🤔

Shouldn't be a boolean instead of hard true ??
What is the reason of setting it to hard true ?

Steps to Reproduce 🕹

We are using styled-components here.

Steps:

  1. Import ListItem from @material-ui/core'.
  2. Style it with styled-components.
  3. Use ListItem component without button prop. Eslint will produce an error message.
  4. Code sandbox

Context 🔦

We are using ListItem as a menu list with button. but some of them are not using button for some special condition. We have to make a turn around to solve it. With this error, we can't use ListItem anymore to prevent inconsistent code.

Your Environment 🌎

Tech Version
Material-UI v4.11.0
React v16.13.1
Browser v 84.0.4147.135 (Official Build) (64-bit)
TypeScript v4.0.2
@AhmedBHameed AhmedBHameed added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 29, 2020
@eps1lon
Copy link
Member

eps1lon commented Aug 30, 2020

Duplicate of #14971

@eps1lon eps1lon marked this as a duplicate of #14971 Aug 30, 2020
@eps1lon eps1lon closed this as completed Aug 30, 2020
@eps1lon eps1lon added component: list This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists typescript and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: list This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists typescript
Projects
None yet
Development

No branches or pull requests

2 participants