-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
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
Breakpoints override fails in .tsx files #20292
Comments
You need to augment the theme: https://material-ui.com/guides/typescript/#customization-of-theme. |
This comment has been minimized.
This comment has been minimized.
@oliviertassinari Sorry, but module augmentation is not possible since declare module "@material-ui/core/styles/createBreakpoints"
{
export type Breakpoint = "xs" | "sm" | "md" | "lg";
} The above module augmentation will throw the following error:
|
I guess that in this case, you could need to augment |
@oliviertassinari I've come up a way to fix this in #20901. |
Overriding breakpoints through createMuiTheme fails in typescript files.
Current Behavior 😯
Typescript throws
Argument of type '"xlg"' is not assignable to parameter of type 'number | "xs" | "sm" | "md" | "lg" | "xl"'.ts(2345)
when breakpoint has been overridden correctly.
Expected Behavior 🤔
Breakpoint should override in makeStyles.
Steps to Reproduce 🕹
createMuiTheme function
createMuiTheme({ breakpoints: { keys: ["xs", "sm", "md", "lg", "xlg", "xl"], values: { xs: 0, sm: 600, md: 960, lg: 1280, xlg: 1872, xl: 1920 } },
use in makeStyles
[theme.breakpoints.down("xlg")]: { content:
'Screen size = xlg'},
xlg throws error in vscode.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: