solidjs / solid-styled-components

A 1kb Styled Components library for Solid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I'm pretty sure the Types are wrong

ryansolid opened this issue · 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.

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

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.

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

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

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.