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

[TS] ListItemProps seems broken #16153

Closed
2 tasks done
vmajsuk opened this issue Jun 11, 2019 · 1 comment
Closed
2 tasks done

[TS] ListItemProps seems broken #16153

vmajsuk opened this issue Jun 11, 2019 · 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 v4.x

Comments

@vmajsuk
Copy link

vmajsuk commented Jun 11, 2019

There are typescript errors when passing props of type ListItemProps to ListItem:

const MyListItem = (props: ListItemProps) => <ListItem {...props} />
  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

No errors.

Current Behavior 😯

Type '{ alignItems?: "flex-start" | "center"; button?: boolean; ContainerComponent?: ElementType<HTMLAttributes<HTMLDivElement>>; ContainerProps?: HTMLAttributes<HTMLDivElement>; ... 263 more ...; onTransitionEndCapture?: (event: TransitionEvent<...>) => void; }' is not assignable to type '{ button: true; }'.
  Types of property 'button' are incompatible.
    Type 'boolean' is not assignable to type 'true'

The error disappears when providing button={false} explicitly:

const MyListItem = (props: ListItemProps) => <ListItem {...props} button={false} />

Steps to Reproduce 🕹

Link:

  1. https://codesandbox.io/s/create-react-app-with-typescript-4iubx

Context 🔦

I'm trying to customize ListItem wrapper in the typescript project

Your Environment 🌎

Tech Version
Material-UI v4.1.0
React v16.8.x
Browser
TypeScript v3.5.1
etc.
@eps1lon
Copy link
Member

eps1lon commented Jun 11, 2019

Duplicate of #14971

@eps1lon eps1lon marked this as a duplicate of #14971 Jun 11, 2019
@eps1lon eps1lon closed this as completed Jun 11, 2019
@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 20, 2022
@zannager zannager added duplicate This issue or pull request already exists component: list This is the name of the generic UI component, not the React module! typescript v4.x and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 6, 2023
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 v4.x
Projects
None yet
Development

No branches or pull requests

4 participants