Using TypeScript with Material-UI makeStyles Webhook

淺唱寂寞╮ 提交于 2020-03-25 19:10:41

问题


I had successfully used TS with my old HOC styled styles from MUI. But now we have moved to hooks I am unsure to get this to validate.

import makeStyles from '@material-ui/core/styles/makeStyles'
import { Theme } from '@material-ui/core'

export default makeStyles((theme: Theme) => ({
  adminNav: {
    '&.MuiList-root ': {
      width: '100%',
      overflow: 'hidden',
      '& a': {
        float: 'left',
      },
    },
  },
}))

Argument type (theme: Theme) => {adminNav: {'&.MuiList-root ': {overflow: string, '& a': {float: string}, width: string}}} is not assignable to parameter type Styles Inspection info: Checks that TypeScript called function parameters, return values, assigned expressions are of the correct type.

来源:https://stackoverflow.com/questions/59604744/using-typescript-with-material-ui-makestyles-webhook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!