solid-styled-components icon indicating copy to clipboard operation
solid-styled-components copied to clipboard

I'm pretty sure the Types are wrong

Open ryansolid opened this issue 3 years ago • 4 comments

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 avatar Jun 28 '21 06:06 ryansolid

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

priyanshk20 avatar Jun 28 '21 08:06 priyanshk20

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.

ryansolid avatar Jun 28 '21 08:06 ryansolid

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

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

btakita avatar Jun 29 '21 02:06 btakita

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.

craig-jennings avatar Sep 14 '21 13:09 craig-jennings