Javascript 使用typescript在材料ui版本4中添加自定义变量

Javascript 使用typescript在材料ui版本4中添加自定义变量,javascript,reactjs,typescript,material-ui,material-design,Javascript,Reactjs,Typescript,Material Ui,Material Design,我想在版本4中添加自定义变量。我已经用typescript创建了我的应用程序。 对于下面的示例,变量已成功添加,工作正常,但我收到了typescript预测错误 const FancyButton = withStyles ({ root: {........}, contained: {..............}, containedPrimary: {........................}, customVariant: { backgroundColor: &qu

我想在版本4中添加自定义变量。我已经用typescript创建了我的应用程序。 对于下面的示例,变量已成功添加,工作正常,但我收到了typescript预测错误

const FancyButton = withStyles ({
root: {........},
contained: {..............},
containedPrimary: {........................},
customVariant: {
     backgroundColor: "red",
}
})(Button);

<FancyButton variant="customVariant">Click</FancyButton>
const FancyButton=withStyles({
根:{……。},
包含:{………},
containedPrimary:{……},
自定义变量:{
背景颜色:“红色”,
}
})(按钮);
点击
点击 //该示例运行良好,但在编译时会显示typescript预测错误


如何解决类型脚本预测

您不能在材质UI版本4中使用自定义变量。