cssinjs / theming

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

ThemeProvider is not working with TypeScript #64

Closed janhartmann closed 5 years ago

janhartmann commented 5 years ago

Using the ThemeProvider like so:

import { ThemeProvider } from "theming";

<ThemeProvider theme={myTheme}>
    <App />
</ThemeProvider>

Gives the following compile error:

[ts] JSX element class does not support attributes because it does not have a 'props' property. [2607]
[ts] Property 'theme' does not exist on type '{}'. [2339]

Also making the options optional on the withTheme would be great.

export default withTheme(injectSheet(styles)(App), {
  forwardInnerRef: true // <--- this
});

Broke in the newest version 2.1.0.

HenriBeck commented 5 years ago

Thanks for the report. I was using the wrong factory type for the default ThemeProvider.

Could you please approve the PR so I could release a fix?

HenriBeck commented 5 years ago

Okay, release as 2.1.1