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

I'm pretty sure the Types are wrong #2

Open
ryansolid opened this issue Jun 28, 2021 · 4 comments
Open

I'm pretty sure the Types are wrong #2

ryansolid opened this issue Jun 28, 2021 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ryansolid
Copy link
Member

They seem to only be keyed to intrinsic elements. This was something I had borrowed from goober ages ago and I'm positive it isn't right. PRs welcome.

@ryansolid ryansolid added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Jun 28, 2021
@priyanshk20
Copy link

Can you please explain the issue more? I will be happy to fix it.

@ryansolid
Copy link
Member Author

The styled function takes both intrinsic elements like "div" and Components. Ie.

const SuperDiv = styled("div")`
  color: red
`

const UltraDiv = styled(SuperDiv)`
  background-color: yellow
`

I don't thing the types handle the 2nd case. There are a ton of forms of how the tagged templates interpolate that I think are mostly correct it's just wrapping components I think is off.

@btakita
Copy link
Contributor

btakita commented Jun 29, 2021

const NumberInput = styled('input')`
width: 5em;
text-align: right;
`

Does not allow the type prop. The type is IntrinsicAttributes & HTMLAttributes<InputHTMLAttributes<HTMLInputElement>>

@craig-jennings
Copy link

I've also run into this scenario with types - https://codesandbox.io/s/strange-fast-spohy?file=/src/main.tsx. Notice that typescript complains that the <Wrapper> component should have an href prop which doesn't make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants