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

[Typescript] component prop on listitem doesn't allow you to specify component as div and button as false #15106

Closed
MastroLindus opened this issue Mar 29, 2019 · 1 comment

Comments

@MastroLindus
Copy link

MastroLindus commented Mar 29, 2019

Version: 4.0.alpha5

I am aware of the work and issues around the typings for the component prop and the efforts to fix it like #13868

However the current typings seems to have some issues when trying to specify both button props and component props at the same time.
If I try to do this:

  const component = asDiv ? "div" : "li";  
const buttonProps = isButton ? { button: true } : {button: false};
<ListItem<typeof component> {...rest} {...buttonProps} component={component}>
// the rest
</ListItem>

I get:
Types of property 'button' are incompatible.
Type 'boolean' is not assignable to type 'true'.

The typings don't allow me to specify a boolean for button, but only either the literal true or the literal false

@eps1lon
Copy link
Member

eps1lon commented Mar 29, 2019

Duplicate of #14971

@eps1lon eps1lon marked this as a duplicate of #14971 Mar 29, 2019
@eps1lon eps1lon closed this as completed Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants