import {createTheme, type ThemeOptions} from '@mui/material'; import merge from 'lodash/merge'; type DeepPartial = T extends object ? { [P in keyof T]?: DeepPartial; } : T; export function themeGenerator( templateConfig: ThemeOptions, config?: DeepPartial, ) { const mergedThemes: ThemeOptions = merge(templateConfig, config); return createTheme(mergedThemes); }