solidjs / solid-styled-components

A 1kb Styled Components library for Solid
MIT License
280 stars 26 forks source link

I'm pretty sure the Types are wrong #2

Open ryansolid opened 3 years ago

ryansolid commented 3 years ago

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.

priyanshk20 commented 3 years ago

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

ryansolid commented 3 years ago

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 commented 3 years ago
const NumberInput = styled('input')`
width: 5em;
text-align: right;
`

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

craig-jennings commented 2 years ago

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.