Encountering a typescript error when attempting to utilize custom names for breakpoint values:
Type '{ mobile: number; tablet: number; desktop: number;}' is not compatible with type '{ xs: number; sm: number; md: number; lg: number; xl: number; }'.
Object literal can only define known properties, and 'mobile' is not present in the type '{ xs: number; sm: number; md: number; lg: number; xl: number; }'.
Below is my ThemProvider implementation:
import { ThemeProvider, createTheme } from "@mui/material/styles";
<ThemeProvider
theme={createTheme({
breakpoints: {
values: {
mobile: 480,
tablet: 750,
desktop: 1076,
},
},
})}
Attempts were made to include a declaration file, which resulted in an import error stating: Module '"@mui/material/styles"' does not have any exported member 'ThemeProvider'. Module '"@mui/material/styles"' does not have any exported member 'createTheme'.
declare module "@mui/material/styles" {
interface BreakpointOverrides {
xs: false; // removes the `xs` breakpoint
sm: false;
md: false;
lg: false;
xl: false;
mobile: true; // adds the `mobile` breakpoint
tablet: true;
laptop: true;
desktop: true;
}
}