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

How to use with styled components #14

Open
danvim opened this issue Jul 15, 2023 · 0 comments
Open

How to use with styled components #14

danvim opened this issue Jul 15, 2023 · 0 comments

Comments

@danvim
Copy link

danvim commented Jul 15, 2023

Not strictly an issue of this library but a question about integrating with styled-components.

I have the following piece of code and styled-components is unable to deduce h1 attributes of StyledHeading. With only as={} suggested when creating a StyledHeading tag and any other attributes being any. Upon checking the typing from my IDE, I see that StyledHeading has type StyledComponent<PolymorphicForwardRefExoticComponent<P, any>, ...>.

import styled from 'styled-components'

export const Heading: PolymorphicForwardRefExoticComponent<
  HeadingOwnProps,
  typeof HeadingDefaultElement
>(...) => {...}

const StyledHeading = styled(Heading).attrs({
  forwardedAs: 'h1' // or as: 'h1'
})``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant