From 95f72199c23ba32c98a2f18cd9d9d6f26b376d70 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 30 Jun 2024 23:16:53 +0530 Subject: [PATCH] [material-ui] Support `CssVarsTheme` in `responsiveFontSizes` return 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 --- .../src/styles/responsiveFontSize.spec.ts | 16 ++++++++++++++++ .../src/styles/responsiveFontSizes.d.ts | 7 +++---- 2 files changed, 19 insertions(+), 4 deletions(-) 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..d5fd3b16662fa7 --- /dev/null +++ b/packages/mui-material/src/styles/responsiveFontSize.spec.ts @@ -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 & CssVarsTheme, typeof cssVarsTheme>( + cssVarsTheme, +); + +const theme = responsiveFontSizes(createTheme()); +expectType(theme); 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;