Skip to content

Commit e775b63

Browse files
ijxyZeeshanTamboli
authored andcommitted
[material-ui] Support CssVarsTheme in responsiveFontSizes return type (#42786)
Signed-off-by: jxdp <[email protected]> Co-authored-by: ZeeshanTamboli <[email protected]>
1 parent 71bcf1a commit e775b63

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {
2+
responsiveFontSizes,
3+
extendTheme,
4+
createTheme,
5+
Theme,
6+
CssVarsTheme,
7+
} from '@mui/material/styles';
8+
import { expectType } from '@mui/types';
9+
10+
const cssVarsTheme = responsiveFontSizes(extendTheme());
11+
expectType<Omit<Theme, 'applyStyles'> & CssVarsTheme, typeof cssVarsTheme>(cssVarsTheme);
12+
13+
const theme = responsiveFontSizes(createTheme());
14+
expectType<Theme, typeof theme>(theme);
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Breakpoint } from '@mui/system';
22
import { Typography } from './createTypography';
3-
import { Theme } from './createTheme';
43

54
export interface ResponsiveFontSizesOptions {
65
breakpoints?: Breakpoint[];
@@ -9,7 +8,7 @@ export interface ResponsiveFontSizesOptions {
98
variants?: Array<keyof Typography>;
109
}
1110

12-
export default function responsiveFontSizes(
13-
theme: Theme,
11+
export default function responsiveFontSizes<T extends { typography: Typography }>(
12+
theme: T,
1413
options?: ResponsiveFontSizesOptions,
15-
): Theme;
14+
): T;

0 commit comments

Comments
 (0)