styled-components / xstyled

A utility-first CSS-in-JS framework built for React. 💅👩‍🎤⚡️
https://xstyled.dev
MIT License
2.27k stars 107 forks source link

How can I get typescript type inference for the theme values #337

Closed joseDaKing closed 2 years ago

joseDaKing commented 2 years ago

💬 Questions and Help

How can I get typescript type inference for the theme values?

For example, when I try to use the color prop I don't get the type inference for the color values defined in the theme and also in the CSS values

<x.div color=""/>
jguddas commented 2 years ago

Take a look at the docs https://xstyled.dev/docs/typescript/#use-typescript-with-styled-components and this playground.

If you want to customize what color types are possible, have a look at this playground.