问题
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