styled-components / styled-components-website

The styled-components website and documentation
https://styled-components.com
MIT License
611 stars 437 forks source link

Fix attrs examples #929

Closed benbryant0 closed 9 months ago

benbryant0 commented 12 months ago

I noticed a few minor things with the .attrs examples in the docs.

First, fixed a tiny syntax error in the example here that caused an error to show up in the page: image

Next, the generic type parameters seem to be in the wrong position, as the examples all give me type errors when I copy them (SC 6.0.2 & TS 5.1.6): image I could easily be wrong here as I was actually looking at the docs for examples of correct generics with .attrs 😅, but moving the param seems to resolve the error and the props still get typed properly when using the attr-wrapped component.

benbryant0 commented 9 months ago

Closing in favour of #936 as that PR fixes the same issues but they also caught a few things that I missed.