我试图在MUI5中设置定制的排版变体,方法是遵循本指南https://mui.com/customization/typography/#adding-amp-disabling-variants。当我在步骤2中添加类型定义时
declare module '@mui/material/styles' {
interface TypographyVariants {
poster: React.CSSProperties;
}
// allow configuration using `createTheme`
interface TypographyVariantsOptions {
poster?: React.CSSProperties;
}
}
// Update the Typography's variant prop options
declare module '@mui/material/Typography' {
interface TypographyPropsVariantOverrides {
poster: true;
h3: false;
}
}在一个名为typography.d.ts的文件中,用示例交换我实际使用的内容,它似乎覆盖了整个模块,我开始看到以下错误
JSX element type 'Typography' does not have any construct or call signatures.尝试使用排版组件时,或
Module '"@mui/material/styles"' has no exported member 'createTheme'.当尝试创建一个主题时。
有什么想法吗?
发布于 2022-03-31 17:34:31
问题是它在一个*.d.ts文件中;当我将输入移到一个普通的*.ts文件中时,所有的警告都消失了。
https://stackoverflow.com/questions/71696789
复制相似问题