cssinjs / theming

Unified CSSinJS theming solution for React
300 stars 39 forks source link

Support passing a custom theme type-argument to useTheme #93

Closed k-yle closed 3 years ago

k-yle commented 4 years ago

In react-jss, you can pass an optional type-argument to createUseStyles (e.g. createUseStyles<MyTheme>()), which will use MyTheme instead of DefaultTheme.

However, this option is not available for react-jss's useTheme, the type definitions for which come from this package.

I've changed it so you can supply an optional type argument like this:

const { ... } = useTheme<MyTheme>();

which will override the DefaultTheme defined here:

https://github.com/cssinjs/theming/blob/dabb2cb/src/index.d.ts#L3

k-yle commented 3 years ago

Hi @moshest and @vismu, could you please take a look at this if you get a chance?

It's a 1 line change, which doesn't affect any existing users.

Thank you :)