Typescript + Emotion Styled AS prop don't Infer the Component's Type

Viewed 130

I have a simple Button component

const Button = styled("button")

When I use it, I'm able to pass the AS prop like this :

<Button as="a">Hello</Button>

But when I try to get the href props, it's not working. Types from Anchor element don't infer and Typescript throws an error and says that href attribute doesn't exist on this component.

<Button as="a" href="https://example.com">Hello</Button>
0 Answers
Related