类型“ConnectedComponentClass <>”是不能分配给输入“COMPONENTTYPE

问题描述 投票:0回答:1

所以我用反应导航在我的反应本地项目,打字稿及终极版,但是当我的设置的contentComponent道具的drawerNavigator我在打字稿收到此错误。

键入'ConnectedComponentClass<SomeClass>' is not assignable to type 'ComponentType<DrawerItemsProps>' Type 'SomeClass' is missing the following properties from type 'DrawerItemsProps': navigation, items, getLabel, renderIcon, and 2 more.

是否有相同的任何解决办法。

在相同的任何帮助,将不胜感激。

typescript react-native react-navigation react-navigation-drawer
1个回答
0
投票

看来这类型DrawerItemsProps有一个像navigation, items, getLabel, renderIcon多的这些在你的SomeClass接口缺少的属性。

这样就可以使所有这些特性,这是缺少可选使用“?”如下图所示

interface DrawerItemsProps {
  // other properties
  navigation?: yourType,
  items?: yourType, 
  getLabel?: yourType,
  renderIcon?: yourType
}
© www.soinside.com 2019 - 2024. All rights reserved.