From 6f6a355d12d1522486f04b9bbf7795b349fc3234 Mon Sep 17 00:00:00 2001 From: jxdp <32483798+jxdp@users.noreply.github.com> Date: Sat, 29 Jun 2024 11:01:19 +0100 Subject: [PATCH 1/2] [material-ui] Support CssVarsTheme in responsiveFontSizes types (#42760) Signed-off-by: jxdp <32483798+jxdp@users.noreply.github.com> --- packages/mui-material/src/styles/responsiveFontSizes.d.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/mui-material/src/styles/responsiveFontSizes.d.ts b/packages/mui-material/src/styles/responsiveFontSizes.d.ts index 394419e5a8ef0f..ce66cf94eb1347 100644 --- a/packages/mui-material/src/styles/responsiveFontSizes.d.ts +++ b/packages/mui-material/src/styles/responsiveFontSizes.d.ts @@ -1,6 +1,5 @@ import { Breakpoint } from '@mui/system'; import { Typography } from './createTypography'; -import { Theme } from './createTheme'; export interface ResponsiveFontSizesOptions { breakpoints?: Breakpoint[]; @@ -9,7 +8,7 @@ export interface ResponsiveFontSizesOptions { variants?: Array; } -export default function responsiveFontSizes( - theme: Theme, +export default function responsiveFontSizes( + theme: T, options?: ResponsiveFontSizesOptions, -): Theme; +): T; From 6e9b84b4cdf61e52687efbe96fe6ef3585636d4d Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Sun, 30 Jun 2024 20:26:05 +0530 Subject: [PATCH 2/2] add TypeScript test --- .../src/styles/responsiveFontSize.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 packages/mui-material/src/styles/responsiveFontSize.spec.ts diff --git a/packages/mui-material/src/styles/responsiveFontSize.spec.ts b/packages/mui-material/src/styles/responsiveFontSize.spec.ts new file mode 100644 index 00000000000000..1eb6662ae2ef63 --- /dev/null +++ b/packages/mui-material/src/styles/responsiveFontSize.spec.ts @@ -0,0 +1,14 @@ +import { + responsiveFontSizes, + extendTheme, + createTheme, + Theme, + CssVarsTheme, +} from '@mui/material/styles'; +import { expectType } from '@mui/types'; + +const cssVarsTheme = responsiveFontSizes(extendTheme()); +expectType & CssVarsTheme, typeof cssVarsTheme>(cssVarsTheme); + +const theme = responsiveFontSizes(createTheme()); +expectType(theme);