xxxxxxxxxx
import createMuiTheme, { Theme, ThemeOptions } from "@material-ui/core/styles/createMuiTheme";
import { Palette } from "@material-ui/core/styles/createPalette";
interface IPalette extends Palette {
xxx: {}
}
interface ITheme extends Theme {
palette: IPalette;
}
interface IThemeOptions extends ThemeOptions {
palette: IPalette;
}
const theme = createMuiTheme({
palette: {
xxx: {} // Type been checked
}
} as IThemeOptions) // Use customized ThemeOptions type
const useStyles = makeStyles((theme: ITheme) => ({ // Use customized Theme type
root: {
color: theme.palette.xxx // Work with no type error
}
}));