I found CreateCSSProperties is not assignable to CSSProperties after upgrading to 4.0.2.
Below is my code:
import { withStyles, createStyles } from '@material-ui/core/styles';
const styles = createStyles({
logo: {
position: 'fixed',
top: 0,
height: '4rem',
backgroundColor: '#28064A',
width: '100%',
alignItems: 'center',
paddingLeft: '0.5rem',
zIndex: 1
}
}
...
<MenuIcon styles={styles.logo} />
...
```
The `styles` of `MenuIcon` is type of `styles?: React.CSSProperties;`. I get this error:
TS2322: Type 'CreateCSSProperties<{}> | ((props: {}) => CreateCSSProperties<{}>)' is not assignable to type 'CSSProperties | undefined'.
Type 'CreateCSSProperties<{}>' is not assignable to type 'CSSProperties'
```
It seems that after 4.0.2 createStyles returns a type which is not compatible with React.CSSProperties. Is there a quick way to fix it?
Working on a fix.
Is there a quick way to fix it?
Cast the result from createStyles would be the easiest
so you mean using as any?
I was thinking more of styles.logo as CSSProperties but yeah, you can do that as well
Most helpful comment
I was thinking more of
styles.logo as CSSPropertiesbut yeah, you can do that as well