From 3ffa6de38fe4fdedd4253d7c8ca2471dac3f8863 Mon Sep 17 00:00:00 2001 From: Yauheni Pasiukevich Date: Wed, 17 Jul 2024 15:37:38 +0200 Subject: [PATCH] fix types --- src/libs/Navigation/AppNavigator/index.tsx | 5 +++-- src/utils/lazyRetry.ts | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/index.tsx b/src/libs/Navigation/AppNavigator/index.tsx index 787ede6c14f2..a40847376667 100644 --- a/src/libs/Navigation/AppNavigator/index.tsx +++ b/src/libs/Navigation/AppNavigator/index.tsx @@ -2,10 +2,11 @@ import React, {lazy, memo, Suspense, useContext, useEffect} from 'react'; import {NativeModules} from 'react-native'; import {InitialURLContext} from '@components/InitialURLContextProvider'; import Navigation from '@libs/Navigation/Navigation'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; import lazyRetry from '@src/utils/lazyRetry'; -const AuthScreens = lazy(() => lazyRetry(() => import('./AuthScreens'))); -const PublicScreens = lazy(() => lazyRetry(() => import('./PublicScreens'))); +const AuthScreens = lazy(() => lazyRetry(() => import('./AuthScreens'))); +const PublicScreens = lazy(() => lazyRetry(() => import('./PublicScreens'))); type AppNavigatorProps = { /** If we have an authToken this is true */ diff --git a/src/utils/lazyRetry.ts b/src/utils/lazyRetry.ts index 2932d4aae5c9..a5d49bb25d95 100644 --- a/src/utils/lazyRetry.ts +++ b/src/utils/lazyRetry.ts @@ -1,6 +1,6 @@ -import type {ComponentType, LazyExoticComponent} from 'react'; +import type {ComponentType} from 'react'; -type ComponentImport = () => Promise<{default: LazyExoticComponent}>; +type ComponentImport = () => Promise<{default: ComponentType}>; /** * Attempts to lazily import a React component with a retry mechanism on failure. @@ -10,7 +10,7 @@ type ComponentImport = () => Promise<{default: LazyExoticComponent}> { +const lazyRetry = function (componentImport: ComponentImport): Promise<{default: ComponentType}> { return new Promise((resolve, reject) => { // Retrieve the retry status from sessionStorage, defaulting to 'false' if not set const hasRefreshed: unknown = JSON.parse(sessionStorage.getItem('retry-lazy-refreshed') ?? 'false');