typescript - 打字稿错误 - 不要将函数用作类型
问题描述
我已经开始TypeScript
在我的React-Native
项目中使用
我的 linter 不喜欢函数作为一种类型,我该如何重构我的 hoc 以通过我的 linter?
应用导航器:
const withHeader = (
screen: Function,
routeName: string,
Header,
): StackNavigator =>
createStackNavigator(
{
[routeName]: {
screen,
navigationOptions: ({routeName, props}) => ({
header: props => <Header {...props} />,
}),
},
},
{
initialRoute: 'Home',
cardStyle: {
backgroundColor: 'transparent',
opacity: 1,
},
transitionConfig: () => ({
containerStyle: {
backgroundColor: 'transparent',
},
}),
},
);
我的打包程序还给我一个相同文件的错误:
error: bundling failed: Error: Unable to resolve module `./navigation/AppNavigator` from `C:\Users\Matt\sites\IAapp\App.tsx`: The module `./navigation/AppNavigator` could not be found from `C:\Users\Matt\sites\IAapp\App.tsx`. Indeed, none of these files exist:
解决方案
推荐阅读
- swift - 如何从自定义类提供“已发送操作”?
- java - 运算符在作为字符串给出的中缀表达式的后缀表示法的输出中放错了位置
- java - Maven - 如何从生成的 JAR 中排除依赖项
- javascript - javascript,节点,从其他对象属性生成对象属性,或默认
- ios - 自定义 URI 方案“不支持的 URL”
- c# - 数据触发器自动反转颜色
- django - 将验证错误消息添加到基于类的视图 (CreateView)
- java - JPA:多态关联和联接表
- swift - Swift 用于浮点推理的 int 字面量如何工作?
- python - 使用正则表达式 python 在删除特殊字符时保留笑脸/表情符号