Skip to content

Commit

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

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

const cssVarsTheme = responsiveFontSizes(experimental_extendTheme());
expectType<Omit<Theme, 'palette' | '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 95f7219

Please sign in to comment.