【发布时间】:2020-03-11 06:09:12
【问题描述】:
我正在使用 React HOC 编写组件,但在使用 typescript 验证道具时出错。 错误如下
类型'{类型:字符串; imgUrl:任何; vidUrl:任何; }' 不可赋值 输入'IntrinsicAttributes & Pick & { 孩子?:ReactNode;}'。
我的组件是什么样的(示例):
type Props = {
type: string;
imgUrl: any;
vidUrl: any;
}
const Component = ({type,imgUrl,vidUrl}:Props)=> (
<div>.....
.....
</div>
)
export defualt withTranslation('common')(Component);
【问题讨论】:
标签: reactjs typescript react-props react-tsx