我对打字稿是新手,我不知道如何用它正确地打字。我已经花了一整天的时间想办法解决这个问题,但没有成功。我有一个非常基本的BaseComponent代码片段和一个简单的HOC。由于某些原因,在创建BaseComponent时,我得到的是类型记录错误:
Type '{ total: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<{}, ComponentState>> & Readonly<
例如,我们有一个容器<ContainerName data=someData>并传递一些道具数据。
在这个容器中,我们使用重新组合,并具有以下代码:
const enhance = compose(
withProps({
statuses: ['ordered', 'received'],
}),
withProps(
// how do I pass props from this container to component ?
),
withState