如何为H1 / H2 / ..标签应用网站范围的样式?

时间:2019-08-18 23:10:00

标签: typescript material-ui

我曾经这样做:

import {createMuiTheme} from '@material-ui/core/styles';

export const theme = createMuiTheme({
  typography: {
    h1: {
      fontSize: '2.85em',
      margin: '0 0 16px', // <-- dies 
    },
    // ..
});

但是编译器死于说不能将边距分配给TypographyStyleOptions。

  TS2326: Types of property 'h1' are incompatible.
     

输入'{fontSize:string;保证金:字符串; }”不能分配给“ TypographyStyleOptions”类型。       对象文字只能指定已知的属性,类型'TypographyStyleOptions'中不存在'margin'。

在更新某些软件包之前,它曾经可以工作。

在每个组件上应用样式对我来说不起作用,因为我需要在markdown渲染器中使用这些样式,该渲染器不会输出React组件

0 个答案:

没有答案