用情感和打字稿样式antd Button组件

时间:2019-03-22 17:26:54

标签: reactjs typescript antd emotion

我正在尝试使用打字稿中的情感来设置一个Antd Button组件的样式,但是当尝试使用Button时,出现以下错误:

  

键入'{children:never []; }”不可分配为“从不”类型。ts(2322)

这是样式的声明:

const SubmitButton = styled(Button)`
     background-color: #000000;
     color: #FFFFFF;
     cursor: pointer;
`;

然后,当我尝试在React组件中使用它时,就像这样:

render() {
      return (
           <div>
                <SubmitButton>CLICK ME</SubmitButton>
           </div>
      );
}

显示样式按钮的定义是:

(alias) const SubmitButton: StyledComponent<never, Pick<never, never>, any>

我缺少什么或做错了什么?以下是我的依赖项:

  • “ antd”:“ ^ 3.15.1”
  • “反应”:“ ^ 16.8.4”
  • “打字稿”:“ 3.3.3333”
  • “ @ emotion / core”:“ ^ 10.0.9”
  • “ @ emotion / styled”:“ ^ 10.0.9”

1 个答案:

答案 0 :(得分:0)

某个组件的子级应该是一个永不但不永不可变的数组。因此,您需要找出哪个组件引发此错误。

相关问题