打字稿错误 - 不要将函数用作类型

Bom*_*ber 5 typescript react-native

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',
                },
            }),
        },
    );
Run Code Online (Sandbox Code Playgroud)

我的打包程序还给我提供了同一文件的错误:

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:
Run Code Online (Sandbox Code Playgroud)