Skip to content

Commit

Permalink
[material-ui] Support CssVarsTheme in responsiveFontSizes return …
Browse files Browse the repository at this point in the history
…type (mui#42786)

Signed-off-by: jxdp <32483798+jxdp@users.noreply.github.com>
Co-authored-by: ZeeshanTamboli <zeeshan.tamboli@gmail.com>
  • Loading branch information
2 people authored and joserodolfofreitas committed Jul 29, 2024
1 parent 3f578ce commit b8293ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 14 additions & 0 deletions packages/mui-material/src/styles/responsiveFontSize.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
responsiveFontSizes,
extendTheme,
createTheme,
Theme,
CssVarsTheme,
} from '@mui/material/styles';
import { expectType } from '@mui/types';

const cssVarsTheme = responsiveFontSizes(extendTheme());
expectType<Omit<Theme, 'applyStyles'> & CssVarsTheme, typeof cssVarsTheme>(cssVarsTheme);

const theme = responsiveFontSizes(createTheme());
expectType<Theme, typeof theme>(theme);
7 changes: 3 additions & 4 deletions packages/mui-material/src/styles/responsiveFontSizes.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Breakpoint } from '@mui/system';
import { Typography } from './createTypography';
import { Theme } from './createTheme';

export interface ResponsiveFontSizesOptions {
breakpoints?: Breakpoint[];
Expand All @@ -9,7 +8,7 @@ export interface ResponsiveFontSizesOptions {
variants?: Array<keyof Typography>;
}

export default function responsiveFontSizes(
theme: Theme,
export default function responsiveFontSizes<T extends { typography: Typography }>(
theme: T,
options?: ResponsiveFontSizesOptions,
): Theme;
): T;

0 comments on commit b8293ee

Please sign in to comment.