添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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?

CreateCSSProperties is not assignable to CSSProperties after upgrading to 4.3.3(from v3)) #17173