diff --git a/.eslintrc.js b/.eslintrc.js index d8f8c15eb878..a4810ddcebcc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -108,7 +108,6 @@ module.exports = { }, rules: { // TypeScript specific rules - '@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/no-unsafe-assignment': 'off', '@typescript-eslint/prefer-enum-initializers': 'error', '@typescript-eslint/no-var-requires': 'off', diff --git a/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts b/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts index 042d91a5b956..3a5912cf3da7 100644 --- a/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts +++ b/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts @@ -1,4 +1,5 @@ import * as github from '@actions/github'; +import type {WebhookPayload} from '@actions/github/lib/interfaces'; import {parse} from '@babel/parser'; import traverse from '@babel/traverse'; import CONST from '@github/libs/CONST'; @@ -8,6 +9,15 @@ import type Category from './Category'; type SuperClassType = {superClass: {name?: string; object: {name: string}; property: {name: string}} | null; name: string}; +type GithubPaylod = WebhookPayload & { + // eslint-disable-next-line @typescript-eslint/naming-convention + pull_request?: { + head: { + ref?: string; + }; + }; +}; + const items = [ "I verified that similar component doesn't exist in the codebase", 'I verified that all props are defined accurately and each prop has a `/** comment above it */`', @@ -77,7 +87,7 @@ async function detectReactComponentInFile(filename: string): Promise>['data']; +type PackageJSON = { + version: string; +}; + async function run(): Promise { // Note: require('package.json').version does not work because ncc will resolve that to a plain string at compile time - const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); - const newVersionTag: string = packageJson.version; + const packageJson: PackageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8')); + const newVersionTag = packageJson.version; try { // Start by fetching the list of recent StagingDeployCash issues, along with the list of open deploy blockers diff --git a/.storybook/webpack.config.ts b/.storybook/webpack.config.ts index 09d881846b1e..a7811a5a387d 100644 --- a/.storybook/webpack.config.ts +++ b/.storybook/webpack.config.ts @@ -21,6 +21,10 @@ type CustomWebpackConfig = { type CustomWebpackFunction = ({file, platform}: Environment) => CustomWebpackConfig; +type WebpackModule = { + default: CustomWebpackFunction; +}; + let envFile: string; switch (process.env.ENV) { case 'production': @@ -34,7 +38,7 @@ switch (process.env.ENV) { } const env = dotenv.config({path: path.resolve(__dirname, `../${envFile}`)}); -const customFunction: CustomWebpackFunction = require('../config/webpack/webpack.common').default; +const customFunction = require('../config/webpack/webpack.common').default; const custom: CustomWebpackConfig = customFunction({file: envFile}); diff --git a/__mocks__/react-native-webview.ts b/__mocks__/react-native-webview.ts index 8266c7b1eda0..6acf58101b55 100644 --- a/__mocks__/react-native-webview.ts +++ b/__mocks__/react-native-webview.ts @@ -1,8 +1,8 @@ -import type {View as RNView} from 'react-native'; +import type ReactNative from 'react-native'; jest.mock('react-native-webview', () => { - const {View} = require('react-native'); + const {View} = require('react-native'); return { - WebView: () => View as RNView, + WebView: () => View, }; }); diff --git a/desktop/createDownloadQueue.ts b/desktop/createDownloadQueue.ts index 4403f989263c..8cc9fef4bbe2 100644 --- a/desktop/createDownloadQueue.ts +++ b/desktop/createDownloadQueue.ts @@ -22,6 +22,10 @@ type CreateDownloadQueue = () => { dequeueDownloadItem: () => DownloadItem | undefined; }; +type CreateDownloadQueueModule = { + default: CreateDownloadQueue; +}; + /** * Returns the filename with extension based on the given name and MIME type. * @param name - The name of the file. @@ -119,4 +123,4 @@ const createDownloadQueue: CreateDownloadQueue = () => { }; export default createDownloadQueue; -export type {DownloadItem, CreateDownloadQueue}; +export type {DownloadItem, CreateDownloadQueueModule}; diff --git a/desktop/main.ts b/desktop/main.ts index 57ea647cc3e2..6ab0bc6579d7 100644 --- a/desktop/main.ts +++ b/desktop/main.ts @@ -13,10 +13,10 @@ import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import type PlatformSpecificUpdater from '@src/setup/platformSetup/types'; import type {Locale} from '@src/types/onyx'; -import type {CreateDownloadQueue, DownloadItem} from './createDownloadQueue'; +import type {CreateDownloadQueueModule, DownloadItem} from './createDownloadQueue'; import ELECTRON_EVENTS from './ELECTRON_EVENTS'; -const createDownloadQueue: CreateDownloadQueue = require('./createDownloadQueue').default; +const createDownloadQueue = require('./createDownloadQueue').default; const port = process.env.PORT ?? 8082; const {DESKTOP_SHORTCUT_ACCELERATOR, LOCALES} = CONST; diff --git a/src/components/AttachmentModal.tsx b/src/components/AttachmentModal.tsx index c3b5acafc6fc..19bad0fbdf5a 100644 --- a/src/components/AttachmentModal.tsx +++ b/src/components/AttachmentModal.tsx @@ -305,7 +305,7 @@ function AttachmentModal({ }, []); const isDirectoryCheck = useCallback((data: FileObject) => { - if ('webkitGetAsEntry' in data && typeof data.webkitGetAsEntry === 'function' && data.webkitGetAsEntry().isDirectory) { + if ('webkitGetAsEntry' in data && (data as DataTransferItem).webkitGetAsEntry()?.isDirectory) { setIsAttachmentInvalid(true); setAttachmentInvalidReasonTitle('attachmentPicker.attachmentError'); setAttachmentInvalidReason('attachmentPicker.folderNotAllowedMessage'); diff --git a/src/components/AttachmentPicker/launchCamera/launchCamera.android.ts b/src/components/AttachmentPicker/launchCamera/launchCamera.android.ts index c4359b06d619..0f551d07019b 100644 --- a/src/components/AttachmentPicker/launchCamera/launchCamera.android.ts +++ b/src/components/AttachmentPicker/launchCamera/launchCamera.android.ts @@ -19,7 +19,7 @@ const launchCamera: LaunchCamera = (options, callback) => { launchCameraImagePicker(options, callback); }) - .catch((error) => { + .catch((error: ErrorLaunchCamera) => { /* Intercept the permission error as well as any other errors and call the callback * follow the same pattern expected for image picker results */ callback({ diff --git a/src/components/AttachmentPicker/launchCamera/launchCamera.ios.ts b/src/components/AttachmentPicker/launchCamera/launchCamera.ios.ts index 7015d4d9ed13..c4983285b6c6 100644 --- a/src/components/AttachmentPicker/launchCamera/launchCamera.ios.ts +++ b/src/components/AttachmentPicker/launchCamera/launchCamera.ios.ts @@ -19,7 +19,7 @@ const launchCamera: LaunchCamera = (options, callback) => { launchCameraImagePicker(options, callback); }) - .catch((error) => { + .catch((error: ErrorLaunchCamera) => { /* Intercept the permission error as well as any other errors and call the callback * follow the same pattern expected for image picker results */ callback({ diff --git a/src/components/Hoverable/ActiveHoverable.tsx b/src/components/Hoverable/ActiveHoverable.tsx index b58433afb17c..abd48d432953 100644 --- a/src/components/Hoverable/ActiveHoverable.tsx +++ b/src/components/Hoverable/ActiveHoverable.tsx @@ -8,7 +8,9 @@ import type HoverableProps from './types'; type ActiveHoverableProps = Omit; -type OnMouseEvent = (e: MouseEvent) => void; +type MouseEvents = 'onMouseEnter' | 'onMouseLeave' | 'onMouseMove' | 'onBlur'; + +type OnMouseEvents = Record void>; function ActiveHoverable({onHoverIn, onHoverOut, shouldHandleScroll, shouldFreezeCapture, children}: ActiveHoverableProps, outerRef: Ref) { const [isHovered, setIsHovered] = useState(false); @@ -100,26 +102,23 @@ function ActiveHoverable({onHoverIn, onHoverOut, shouldHandleScroll, shouldFreez const child = useMemo(() => getReturnValue(children, !isScrollingRef.current && isHovered), [children, isHovered]); - const childOnMouseEnter: OnMouseEvent = child.props.onMouseEnter; - const childOnMouseLeave: OnMouseEvent = child.props.onMouseLeave; - const childOnMouseMove: OnMouseEvent = child.props.onMouseMove; - const childOnBlur: OnMouseEvent = child.props.onBlur; + const {onMouseEnter, onMouseLeave, onMouseMove, onBlur}: OnMouseEvents = child.props; const hoverAndForwardOnMouseEnter = useCallback( (e: MouseEvent) => { isVisibiltyHidden.current = false; updateIsHovered(true); - childOnMouseEnter?.(e); + onMouseEnter?.(e); }, - [updateIsHovered, childOnMouseEnter], + [updateIsHovered, onMouseEnter], ); const unhoverAndForwardOnMouseLeave = useCallback( (e: MouseEvent) => { updateIsHovered(false); - childOnMouseLeave?.(e); + onMouseLeave?.(e); }, - [updateIsHovered, childOnMouseLeave], + [updateIsHovered, onMouseLeave], ); const unhoverAndForwardOnBlur = useCallback( @@ -130,18 +129,18 @@ function ActiveHoverable({onHoverIn, onHoverOut, shouldHandleScroll, shouldFreez setIsHovered(false); } - childOnBlur?.(event); + onBlur?.(event); }, - [childOnBlur], + [onBlur], ); const handleAndForwardOnMouseMove = useCallback( (e: MouseEvent) => { isVisibiltyHidden.current = false; updateIsHovered(true); - childOnMouseMove?.(e); + onMouseMove?.(e); }, - [updateIsHovered, childOnMouseMove], + [updateIsHovered, onMouseMove], ); return cloneElement(child, { diff --git a/src/components/Modal/index.tsx b/src/components/Modal/index.tsx index 325fb4ca6ab8..12da8a894282 100644 --- a/src/components/Modal/index.tsx +++ b/src/components/Modal/index.tsx @@ -5,6 +5,7 @@ import StatusBar from '@libs/StatusBar'; import CONST from '@src/CONST'; import BaseModal from './BaseModal'; import type BaseModalProps from './types'; +import type {WindowState} from './types'; function Modal({fullscreen = true, onModalHide = () => {}, type, onModalShow = () => {}, children, shouldHandleNavigationBack, ...rest}: BaseModalProps) { const theme = useTheme(); @@ -22,7 +23,7 @@ function Modal({fullscreen = true, onModalHide = () => {}, type, onModalShow = ( const hideModal = () => { setStatusBarColor(previousStatusBarColor); onModalHide(); - if (window.history.state?.shouldGoBack) { + if ((window.history.state as WindowState)?.shouldGoBack) { window.history.back(); } }; diff --git a/src/components/Modal/types.ts b/src/components/Modal/types.ts index 3621ccd5817b..4971932b69c8 100644 --- a/src/components/Modal/types.ts +++ b/src/components/Modal/types.ts @@ -10,6 +10,10 @@ type PopoverAnchorPosition = { left?: number; }; +type WindowState = { + shouldGoBack: boolean; +}; + type BaseModalProps = Partial & { /** Decides whether the modal should cover fullscreen. FullScreen modal has backdrop */ fullscreen?: boolean; @@ -86,4 +90,4 @@ type BaseModalProps = Partial & { }; export default BaseModalProps; -export type {PopoverAnchorPosition}; +export type {PopoverAnchorPosition, WindowState}; diff --git a/src/components/Onfido/BaseOnfidoWeb.tsx b/src/components/Onfido/BaseOnfidoWeb.tsx index 94124180bea3..ebb29198bda7 100644 --- a/src/components/Onfido/BaseOnfidoWeb.tsx +++ b/src/components/Onfido/BaseOnfidoWeb.tsx @@ -1,5 +1,4 @@ import {Onfido as OnfidoSDK} from 'onfido-sdk-ui'; -import type {ErrorType} from 'onfido-sdk-ui/types/Types'; import React, {forwardRef, useEffect} from 'react'; import type {ForwardedRef} from 'react'; import type {LocaleContextProps} from '@components/LocaleContextProvider'; @@ -12,7 +11,7 @@ import variables from '@styles/variables'; import CONST from '@src/CONST'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import './index.css'; -import type {OnfidoElement, OnfidoProps} from './types'; +import type {OnfidoElement, OnfidoError, OnfidoProps} from './types'; type InitializeOnfidoProps = OnfidoProps & Pick & { @@ -93,7 +92,7 @@ function initializeOnfido({sdkToken, onSuccess, onError, onUserExit, preferredLo } onSuccess(data); }, - onError: (error: ErrorType) => { + onError: (error: OnfidoError) => { const errorType = error.type; const errorMessage: string = error.message ?? CONST.ERROR.UNKNOWN_ERROR; Log.hmmm('Onfido error', {errorType, errorMessage}); diff --git a/src/components/Onfido/index.native.tsx b/src/components/Onfido/index.native.tsx index 10badbcec414..fd681e610f86 100644 --- a/src/components/Onfido/index.native.tsx +++ b/src/components/Onfido/index.native.tsx @@ -1,5 +1,4 @@ import {OnfidoCaptureType, OnfidoCountryCode, OnfidoDocumentType, Onfido as OnfidoSDK, OnfidoTheme} from '@onfido/react-native-sdk'; -import type {ErrorType} from 'onfido-sdk-ui/types/Types'; import React, {useEffect} from 'react'; import {Alert, Linking} from 'react-native'; import {checkMultiple, PERMISSIONS, RESULTS} from 'react-native-permissions'; @@ -9,7 +8,7 @@ import getPlatform from '@libs/getPlatform'; import Log from '@libs/Log'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; -import type {OnfidoProps} from './types'; +import type {OnfidoError, OnfidoProps} from './types'; function Onfido({sdkToken, onUserExit, onSuccess, onError}: OnfidoProps) { const {translate} = useLocalize(); @@ -30,7 +29,7 @@ function Onfido({sdkToken, onUserExit, onSuccess, onError}: OnfidoProps) { }, }) .then(onSuccess) - .catch((error: ErrorType) => { + .catch((error: OnfidoError) => { const errorMessage: string = error.message ?? CONST.ERROR.UNKNOWN_ERROR; const errorType = error.type; diff --git a/src/components/Onfido/types.ts b/src/components/Onfido/types.ts index 4005dc2597cb..3e88ce3b2dda 100644 --- a/src/components/Onfido/types.ts +++ b/src/components/Onfido/types.ts @@ -25,4 +25,8 @@ type OnfidoProps = { onError: (error?: string) => void; }; -export type {OnfidoProps, OnfidoElement, OnfidoData, OnfidoDataWithApplicantID}; +type OnfidoError = Error & { + type?: string; +}; + +export type {OnfidoProps, OnfidoElement, OnfidoData, OnfidoDataWithApplicantID, OnfidoError}; diff --git a/src/components/SignInButtons/GoogleSignIn/index.native.tsx b/src/components/SignInButtons/GoogleSignIn/index.native.tsx index 3fac942c1279..4a70a10ef017 100644 --- a/src/components/SignInButtons/GoogleSignIn/index.native.tsx +++ b/src/components/SignInButtons/GoogleSignIn/index.native.tsx @@ -6,6 +6,7 @@ import * as Session from '@userActions/Session'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; import type {GoogleSignInProps} from '.'; +import type GoogleError from './types'; /** * Google Sign In method for iOS and android that returns identityToken. @@ -25,10 +26,11 @@ function googleSignInRequest() { GoogleSignin.signIn() .then((response) => response.idToken) .then((token) => Session.beginGoogleSignIn(token)) - .catch((error) => { + .catch((error: GoogleError | undefined) => { // Handle unexpected error shape - if (error === undefined || error.code === undefined) { - Log.alert(`[Google Sign In] Google sign in failed: ${error}`); + if (error?.code === undefined) { + Log.alert(`[Google Sign In] Google sign in failed: ${JSON.stringify(error)}`); + return; } /** The logged code is useful for debugging any new errors that are not specifically handled. To decode, see: - The common status codes documentation: https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes diff --git a/src/components/SignInButtons/GoogleSignIn/types.ts b/src/components/SignInButtons/GoogleSignIn/types.ts new file mode 100644 index 000000000000..81694ca06821 --- /dev/null +++ b/src/components/SignInButtons/GoogleSignIn/types.ts @@ -0,0 +1,5 @@ +type GoogleError = Error & { + code?: string; +}; + +export default GoogleError; diff --git a/src/components/Tooltip/BaseTooltip/index.tsx b/src/components/Tooltip/BaseTooltip/index.tsx index 90b3b2429310..df8d9c9c950d 100644 --- a/src/components/Tooltip/BaseTooltip/index.tsx +++ b/src/components/Tooltip/BaseTooltip/index.tsx @@ -7,6 +7,10 @@ import GenericTooltip from '@components/Tooltip/GenericTooltip'; import type TooltipProps from '@components/Tooltip/types'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; +type MouseEvents = { + onMouseEnter: (e: MouseEvent) => void | undefined; +}; + const hasHoverSupport = DeviceCapabilities.hasHoverSupport(); /** @@ -76,7 +80,7 @@ function Tooltip({children, shouldHandleScroll = false, ...props}: TooltipProps, (e: MouseEvent) => { updateTargetAndMousePosition(e); if (React.isValidElement(children)) { - const onMouseEnter: (e: MouseEvent) => void | undefined = children.props.onMouseEnter; + const onMouseEnter = (children.props as MouseEvents).onMouseEnter; onMouseEnter?.(e); } }, diff --git a/src/libs/DomUtils/index.ts b/src/libs/DomUtils/index.ts index 330123833c1f..e6286dce77fc 100644 --- a/src/libs/DomUtils/index.ts +++ b/src/libs/DomUtils/index.ts @@ -8,8 +8,7 @@ const addCSS = (css: string, styleId: string) => { if (existingStyle) { if ('styleSheet' in existingStyle) { // Supports IE8 and below - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (existingStyle.styleSheet as any).cssText = css; + (existingStyle.styleSheet as CSSStyleDeclaration).cssText = css; } else { existingStyle.innerHTML = css; } @@ -20,8 +19,7 @@ const addCSS = (css: string, styleId: string) => { if ('styleSheet' in styleElement) { // Supports IE8 and below - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (styleElement.styleSheet as any).cssText = css; + (styleElement.styleSheet as CSSStyleDeclaration).cssText = css; } else { styleElement.appendChild(document.createTextNode(css)); } diff --git a/src/libs/E2E/reactNativeLaunchingTest.ts b/src/libs/E2E/reactNativeLaunchingTest.ts index f23508987268..46922091497c 100644 --- a/src/libs/E2E/reactNativeLaunchingTest.ts +++ b/src/libs/E2E/reactNativeLaunchingTest.ts @@ -5,7 +5,6 @@ * By doing this, we avoid bundling any E2E testing code * into the actual release app. */ -import type {ValueOf} from 'type-fest'; import * as Metrics from '@libs/Metrics'; import Performance from '@libs/Performance'; import Config from 'react-native-config'; @@ -13,9 +12,7 @@ import E2EConfig from '../../../tests/e2e/config'; import E2EClient from './client'; import installNetworkInterceptor from './utils/NetworkInterceptor'; import LaunchArgs from './utils/LaunchArgs'; -import type { TestConfig } from './types'; - -type Tests = Record, (config: TestConfig) => void>; +import type {TestModule, Tests} from './types'; console.debug('=========================='); console.debug('==== Running e2e test ===='); @@ -34,11 +31,11 @@ if (!appInstanceId) { // import your test here, define its name and config first in e2e/config.js const tests: Tests = { - [E2EConfig.TEST_NAMES.AppStartTime]: require('./tests/appStartTimeTest.e2e').default, - [E2EConfig.TEST_NAMES.OpenChatFinderPage]: require('./tests/openChatFinderPageTest.e2e').default, - [E2EConfig.TEST_NAMES.ChatOpening]: require('./tests/chatOpeningTest.e2e').default, - [E2EConfig.TEST_NAMES.ReportTyping]: require('./tests/reportTypingTest.e2e').default, - [E2EConfig.TEST_NAMES.Linking]: require('./tests/linkingTest.e2e').default, + [E2EConfig.TEST_NAMES.AppStartTime]: require('./tests/appStartTimeTest.e2e').default, + [E2EConfig.TEST_NAMES.OpenChatFinderPage]: require('./tests/openChatFinderPageTest.e2e').default, + [E2EConfig.TEST_NAMES.ChatOpening]: require('./tests/chatOpeningTest.e2e').default, + [E2EConfig.TEST_NAMES.ReportTyping]: require('./tests/reportTypingTest.e2e').default, + [E2EConfig.TEST_NAMES.Linking]: require('./tests/linkingTest.e2e').default, }; // Once we receive the TII measurement we know that the app is initialized and ready to be used: diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index 62a4581a5036..a3449ce5010b 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -12,6 +12,12 @@ import Performance from '@libs/Performance'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; +type ViewableItem = { + reportActionID?: string; +}; + +type ViewableItemResponse = Array<{item?: ViewableItem}>; + const test = (config: NativeConfig) => { console.debug('[E2E] Logging in for comment linking'); @@ -36,10 +42,10 @@ const test = (config: NativeConfig) => { console.debug('[E2E] Error while submitting test results:', err); }); - const subscription = DeviceEventEmitter.addListener('onViewableItemsChanged', (res) => { + const subscription = DeviceEventEmitter.addListener('onViewableItemsChanged', (res: ViewableItemResponse) => { console.debug('[E2E] Viewable items retrieved, verifying correct messageā€¦', res); - if (!!res && res[0]?.item?.reportActionID === linkedReportActionID) { + if (!!res && res?.[0]?.item?.reportActionID === linkedReportActionID) { appearMessageResolve(); subscription.remove(); } else { diff --git a/src/libs/E2E/types.ts b/src/libs/E2E/types.ts index 5cd6692c9215..fdbc01872cb3 100644 --- a/src/libs/E2E/types.ts +++ b/src/libs/E2E/types.ts @@ -1,5 +1,6 @@ import type {TEST_NAMES} from 'tests/e2e/config'; import type {ValueOf} from 'type-fest'; +import type E2EConfig from '../../../tests/e2e/config'; type SigninParams = { email?: string; @@ -26,6 +27,12 @@ type TestConfig = { [key: string]: string | {autoFocus: boolean}; }; +type Test = (config: TestConfig) => void; + +type TestModule = {default: Test}; + +type Tests = Record, Test>; + type TestResult = { /** Name of the test */ name: string; @@ -49,4 +56,4 @@ type TestResult = { renderCount?: number; }; -export type {SigninParams, IsE2ETestSession, NetworkCacheMap, NetworkCacheEntry, TestConfig, TestResult}; +export type {SigninParams, IsE2ETestSession, NetworkCacheMap, NetworkCacheEntry, TestConfig, TestResult, TestModule, Tests}; diff --git a/src/libs/EmojiUtils.ts b/src/libs/EmojiUtils.ts index 6fb189e7ad05..6fb5725addfc 100644 --- a/src/libs/EmojiUtils.ts +++ b/src/libs/EmojiUtils.ts @@ -18,6 +18,7 @@ type EmojiSpacer = {code: string; spacer: boolean}; type EmojiPickerListItem = EmojiSpacer | Emoji | HeaderEmoji; type EmojiPickerList = EmojiPickerListItem[]; type ReplacedEmoji = {text: string; emojis: Emoji[]; cursorPosition?: number}; +type EmojiTrieModule = {default: typeof EmojiTrie}; const findEmojiByName = (name: string): Emoji => Emojis.emojiNameTable[name]; @@ -334,7 +335,7 @@ function getAddedEmojis(currentEmojis: Emoji[], formerEmojis: Emoji[]): Emoji[] */ function replaceEmojis(text: string, preferredSkinTone: OnyxEntry = CONST.EMOJI_DEFAULT_SKIN_TONE, lang: Locale = CONST.LOCALES.DEFAULT): ReplacedEmoji { // emojisTrie is importing the emoji JSON file on the app starting and we want to avoid it - const emojisTrie: typeof EmojiTrie = require('./EmojiTrie').default; + const emojisTrie = require('./EmojiTrie').default; const trie = emojisTrie[lang as SupportedLanguage]; if (!trie) { @@ -412,7 +413,7 @@ function replaceAndExtractEmojis(text: string, preferredSkinTone: OnyxEntry('./EmojiTrie').default; const trie = emojisTrie[lang as SupportedLanguage]; if (!trie) { diff --git a/src/libs/Environment/betaChecker/index.android.ts b/src/libs/Environment/betaChecker/index.android.ts index b6cc8f671991..0592cc0b3923 100644 --- a/src/libs/Environment/betaChecker/index.android.ts +++ b/src/libs/Environment/betaChecker/index.android.ts @@ -6,6 +6,11 @@ import ONYXKEYS from '@src/ONYXKEYS'; import pkg from '../../../../package.json'; import type {IsBetaBuild} from './types'; +type GithubReleaseJSON = { + // eslint-disable-next-line @typescript-eslint/naming-convention + tag_name: string | semver.SemVer; +}; + let isLastSavedBeta = false; Onyx.connect({ key: ONYXKEYS.IS_BETA, @@ -21,8 +26,8 @@ function isBetaBuild(): IsBetaBuild { return new Promise((resolve) => { fetch(CONST.GITHUB_RELEASE_URL) .then((res) => res.json()) - .then((json) => { - const productionVersion: string | semver.SemVer = json.tag_name; + .then((json: GithubReleaseJSON) => { + const productionVersion = json.tag_name; if (!productionVersion) { AppUpdate.setIsAppInBeta(false); resolve(false); diff --git a/src/libs/Middleware/RecheckConnection.ts b/src/libs/Middleware/RecheckConnection.ts index f3f7d2e7b688..e62c716013cd 100644 --- a/src/libs/Middleware/RecheckConnection.ts +++ b/src/libs/Middleware/RecheckConnection.ts @@ -15,7 +15,7 @@ const RecheckConnection: Middleware = (response) => { // When the request goes past a certain amount of time we trigger a re-check of the connection const cancelRequestTimeoutTimer = startRecheckTimeoutTimer(); return response - .catch((error) => { + .catch((error: Error) => { if (error.name !== CONST.ERROR.REQUEST_CANCELLED) { // Because we ran into an error we assume we might be offline and do a "connection" health test NetworkConnection.recheckNetworkConnection(); diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 2c8e2c6bfa80..a185145aadce 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -41,6 +41,7 @@ import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; import type {SelectedTimezone, Timezone} from '@src/types/onyx/PersonalDetails'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import createCustomStackNavigator from './createCustomStackNavigator'; import defaultScreenOptions from './defaultScreenOptions'; import getRootNavigatorScreenOptions from './getRootNavigatorScreenOptions'; @@ -64,15 +65,15 @@ type AuthScreensProps = { initialLastUpdateIDAppliedToClient: OnyxEntry; }; -const loadReportAttachments = () => require('../../../pages/home/report/ReportAttachments').default as React.ComponentType; -const loadValidateLoginPage = () => require('../../../pages/ValidateLoginPage').default as React.ComponentType; -const loadLogOutPreviousUserPage = () => require('../../../pages/LogOutPreviousUserPage').default as React.ComponentType; -const loadConciergePage = () => require('../../../pages/ConciergePage').default as React.ComponentType; -const loadProfileAvatar = () => require('../../../pages/settings/Profile/ProfileAvatar').default as React.ComponentType; -const loadWorkspaceAvatar = () => require('../../../pages/workspace/WorkspaceAvatar').default as React.ComponentType; -const loadReportAvatar = () => require('../../../pages/ReportAvatar').default as React.ComponentType; -const loadReceiptView = () => require('../../../pages/TransactionReceiptPage').default as React.ComponentType; -const loadWorkspaceJoinUser = () => require('@pages/workspace/WorkspaceJoinUserPage').default as React.ComponentType; +const loadReportAttachments = () => require('../../../pages/home/report/ReportAttachments').default; +const loadValidateLoginPage = () => require('../../../pages/ValidateLoginPage').default; +const loadLogOutPreviousUserPage = () => require('../../../pages/LogOutPreviousUserPage').default; +const loadConciergePage = () => require('../../../pages/ConciergePage').default; +const loadProfileAvatar = () => require('../../../pages/settings/Profile/ProfileAvatar').default; +const loadWorkspaceAvatar = () => require('../../../pages/workspace/WorkspaceAvatar').default; +const loadReportAvatar = () => require('../../../pages/ReportAvatar').default; +const loadReceiptView = () => require('../../../pages/TransactionReceiptPage').default; +const loadWorkspaceJoinUser = () => require('@pages/workspace/WorkspaceJoinUserPage').default; let timezone: Timezone | null; let currentAccountID = -1; diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 2430b7cd3a36..64f253f7aeea 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -33,6 +33,7 @@ import type { import type {ThemeStyles} from '@styles/index'; import type {Screen} from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import useModalScreenOptions from './useModalScreenOptions'; type Screens = Partial React.ComponentType>>; @@ -68,317 +69,315 @@ function createModalStackNavigator(screens: } const MoneyRequestModalStackNavigator = createModalStackNavigator({ - [SCREENS.MONEY_REQUEST.START]: () => require('../../../../pages/iou/request/IOURequestRedirectToStartPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.CREATE]: () => require('../../../../pages/iou/request/IOURequestStartPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: () => require('../../../../pages/iou/request/step/IOURequestStepConfirmation').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepAmount').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxAmountPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_TAX_RATE]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxRatePage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_CATEGORY]: () => require('../../../../pages/iou/request/step/IOURequestStepCategory').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_CURRENCY]: () => require('../../../../pages/iou/request/step/IOURequestStepCurrency').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_DATE]: () => require('../../../../pages/iou/request/step/IOURequestStepDate').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_DESCRIPTION]: () => require('../../../../pages/iou/request/step/IOURequestStepDescription').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_DISTANCE]: () => require('../../../../pages/iou/request/step/IOURequestStepDistance').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_DISTANCE_RATE]: () => require('@pages/iou/request/step/IOURequestStepDistanceRate').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_MERCHANT]: () => require('../../../../pages/iou/request/step/IOURequestStepMerchant').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_PARTICIPANTS]: () => require('../../../../pages/iou/request/step/IOURequestStepParticipants').default as React.ComponentType, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_ROOT]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_SCAN]: () => require('../../../../pages/iou/request/step/IOURequestStepScan').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_TAG]: () => require('../../../../pages/iou/request/step/IOURequestStepTag').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_WAYPOINT]: () => require('../../../../pages/iou/request/step/IOURequestStepWaypoint').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_SPLIT_PAYER]: () => require('../../../../pages/iou/request/step/IOURequestStepSplitPayer').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_SEND_FROM]: () => require('../../../../pages/iou/request/step/IOURequestStepSendFrom').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.HOLD]: () => require('../../../../pages/iou/HoldReasonPage').default as React.ComponentType, - [SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default as React.ComponentType, - [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType, - [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STATE_SELECTOR]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default as React.ComponentType, + [SCREENS.MONEY_REQUEST.START]: () => require('../../../../pages/iou/request/IOURequestRedirectToStartPage').default, + [SCREENS.MONEY_REQUEST.CREATE]: () => require('../../../../pages/iou/request/IOURequestStartPage').default, + [SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: () => require('../../../../pages/iou/request/step/IOURequestStepConfirmation').default, + [SCREENS.MONEY_REQUEST.STEP_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepAmount').default, + [SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxAmountPage').default, + [SCREENS.MONEY_REQUEST.STEP_TAX_RATE]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxRatePage').default, + [SCREENS.MONEY_REQUEST.STEP_CATEGORY]: () => require('../../../../pages/iou/request/step/IOURequestStepCategory').default, + [SCREENS.MONEY_REQUEST.STEP_CURRENCY]: () => require('../../../../pages/iou/request/step/IOURequestStepCurrency').default, + [SCREENS.MONEY_REQUEST.STEP_DATE]: () => require('../../../../pages/iou/request/step/IOURequestStepDate').default, + [SCREENS.MONEY_REQUEST.STEP_DESCRIPTION]: () => require('../../../../pages/iou/request/step/IOURequestStepDescription').default, + [SCREENS.MONEY_REQUEST.STEP_DISTANCE]: () => require('../../../../pages/iou/request/step/IOURequestStepDistance').default, + [SCREENS.MONEY_REQUEST.STEP_DISTANCE_RATE]: () => require('@pages/iou/request/step/IOURequestStepDistanceRate').default, + [SCREENS.MONEY_REQUEST.STEP_MERCHANT]: () => require('../../../../pages/iou/request/step/IOURequestStepMerchant').default, + [SCREENS.MONEY_REQUEST.STEP_PARTICIPANTS]: () => require('../../../../pages/iou/request/step/IOURequestStepParticipants').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_ROOT]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default, + [SCREENS.MONEY_REQUEST.STEP_SCAN]: () => require('../../../../pages/iou/request/step/IOURequestStepScan').default, + [SCREENS.MONEY_REQUEST.STEP_TAG]: () => require('../../../../pages/iou/request/step/IOURequestStepTag').default, + [SCREENS.MONEY_REQUEST.STEP_WAYPOINT]: () => require('../../../../pages/iou/request/step/IOURequestStepWaypoint').default, + [SCREENS.MONEY_REQUEST.STEP_SPLIT_PAYER]: () => require('../../../../pages/iou/request/step/IOURequestStepSplitPayer').default, + [SCREENS.MONEY_REQUEST.STEP_SEND_FROM]: () => require('../../../../pages/iou/request/step/IOURequestStepSendFrom').default, + [SCREENS.MONEY_REQUEST.HOLD]: () => require('../../../../pages/iou/HoldReasonPage').default, + [SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default, + [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, + [SCREENS.MONEY_REQUEST.STATE_SELECTOR]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default, }); const TravelModalStackNavigator = createModalStackNavigator({ - [SCREENS.TRAVEL.MY_TRIPS]: () => require('../../../../pages/Travel/MyTripsPage').default as React.ComponentType, - [SCREENS.TRAVEL.TCS]: () => require('../../../../pages/Travel/TravelTerms').default as React.ComponentType, + [SCREENS.TRAVEL.MY_TRIPS]: () => require('../../../../pages/Travel/MyTripsPage').default, + [SCREENS.TRAVEL.TCS]: () => require('../../../../pages/Travel/TravelTerms').default, }); const SplitDetailsModalStackNavigator = createModalStackNavigator({ - [SCREENS.SPLIT_DETAILS.ROOT]: () => require('../../../../pages/iou/SplitBillDetailsPage').default as React.ComponentType, + [SCREENS.SPLIT_DETAILS.ROOT]: () => require('../../../../pages/iou/SplitBillDetailsPage').default, }); const ProfileModalStackNavigator = createModalStackNavigator({ - [SCREENS.PROFILE_ROOT]: () => require('../../../../pages/ProfilePage').default as React.ComponentType, + [SCREENS.PROFILE_ROOT]: () => require('../../../../pages/ProfilePage').default, }); const ReportDetailsModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_DETAILS.ROOT]: () => require('../../../../pages/ReportDetailsPage').default as React.ComponentType, - [SCREENS.REPORT_DETAILS.SHARE_CODE]: () => require('../../../../pages/home/report/ReportDetailsShareCodePage').default as React.ComponentType, + [SCREENS.REPORT_DETAILS.ROOT]: () => require('../../../../pages/ReportDetailsPage').default, + [SCREENS.REPORT_DETAILS.SHARE_CODE]: () => require('../../../../pages/home/report/ReportDetailsShareCodePage').default, }); const ReportSettingsModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_SETTINGS.ROOT]: () => require('../../../../pages/settings/Report/ReportSettingsPage').default as React.ComponentType, - [SCREENS.REPORT_SETTINGS.NAME]: () => require('../../../../pages/settings/Report/NamePage').default as React.ComponentType, - [SCREENS.REPORT_SETTINGS.NOTIFICATION_PREFERENCES]: () => require('../../../../pages/settings/Report/NotificationPreferencePage').default as React.ComponentType, - [SCREENS.REPORT_SETTINGS.WRITE_CAPABILITY]: () => require('../../../../pages/settings/Report/WriteCapabilityPage').default as React.ComponentType, - [SCREENS.REPORT_SETTINGS.VISIBILITY]: () => require('../../../../pages/settings/Report/VisibilityPage').default as React.ComponentType, + [SCREENS.REPORT_SETTINGS.ROOT]: () => require('../../../../pages/settings/Report/ReportSettingsPage').default, + [SCREENS.REPORT_SETTINGS.NAME]: () => require('../../../../pages/settings/Report/NamePage').default, + [SCREENS.REPORT_SETTINGS.NOTIFICATION_PREFERENCES]: () => require('../../../../pages/settings/Report/NotificationPreferencePage').default, + [SCREENS.REPORT_SETTINGS.WRITE_CAPABILITY]: () => require('../../../../pages/settings/Report/WriteCapabilityPage').default, + [SCREENS.REPORT_SETTINGS.VISIBILITY]: () => require('../../../../pages/settings/Report/VisibilityPage').default, }); const TaskModalStackNavigator = createModalStackNavigator({ - [SCREENS.TASK.TITLE]: () => require('../../../../pages/tasks/TaskTitlePage').default as React.ComponentType, - [SCREENS.TASK.ASSIGNEE]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default as React.ComponentType, + [SCREENS.TASK.TITLE]: () => require('../../../../pages/tasks/TaskTitlePage').default, + [SCREENS.TASK.ASSIGNEE]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default, }); const ReportDescriptionModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_DESCRIPTION_ROOT]: () => require('../../../../pages/ReportDescriptionPage').default as React.ComponentType, + [SCREENS.REPORT_DESCRIPTION_ROOT]: () => require('../../../../pages/ReportDescriptionPage').default, }); const CategoriesModalStackNavigator = createModalStackNavigator({ - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default as React.ComponentType, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default as React.ComponentType, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default as React.ComponentType, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default as React.ComponentType, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default, }); const ReportParticipantsModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_PARTICIPANTS.ROOT]: () => require('../../../../pages/ReportParticipantsPage').default as React.ComponentType, - [SCREENS.REPORT_PARTICIPANTS.INVITE]: () => require('../../../../pages/InviteReportParticipantsPage').default as React.ComponentType, - [SCREENS.REPORT_PARTICIPANTS.DETAILS]: () => require('../../../../pages/ReportParticipantDetailsPage').default as React.ComponentType, - [SCREENS.REPORT_PARTICIPANTS.ROLE]: () => require('../../../../pages/ReportParticipantRoleSelectionPage').default as React.ComponentType, + [SCREENS.REPORT_PARTICIPANTS.ROOT]: () => require('../../../../pages/ReportParticipantsPage').default, + [SCREENS.REPORT_PARTICIPANTS.INVITE]: () => require('../../../../pages/InviteReportParticipantsPage').default, + [SCREENS.REPORT_PARTICIPANTS.DETAILS]: () => require('../../../../pages/ReportParticipantDetailsPage').default, + [SCREENS.REPORT_PARTICIPANTS.ROLE]: () => require('../../../../pages/ReportParticipantRoleSelectionPage').default, }); const RoomMembersModalStackNavigator = createModalStackNavigator({ - [SCREENS.ROOM_MEMBERS_ROOT]: () => require('../../../../pages/RoomMembersPage').default as React.ComponentType, + [SCREENS.ROOM_MEMBERS_ROOT]: () => require('../../../../pages/RoomMembersPage').default, }); const RoomInviteModalStackNavigator = createModalStackNavigator({ - [SCREENS.ROOM_INVITE_ROOT]: () => require('../../../../pages/RoomInvitePage').default as React.ComponentType, + [SCREENS.ROOM_INVITE_ROOT]: () => require('../../../../pages/RoomInvitePage').default, }); const NewChatModalStackNavigator = createModalStackNavigator({ - [SCREENS.NEW_CHAT.ROOT]: () => require('../../../../pages/NewChatSelectorPage').default as React.ComponentType, - [SCREENS.NEW_CHAT.NEW_CHAT_CONFIRM]: () => require('../../../../pages/NewChatConfirmPage').default as React.ComponentType, - [SCREENS.NEW_CHAT.NEW_CHAT_EDIT_NAME]: () => require('../../../../pages/GroupChatNameEditPage').default as React.ComponentType, + [SCREENS.NEW_CHAT.ROOT]: () => require('../../../../pages/NewChatSelectorPage').default, + [SCREENS.NEW_CHAT.NEW_CHAT_CONFIRM]: () => require('../../../../pages/NewChatConfirmPage').default, + [SCREENS.NEW_CHAT.NEW_CHAT_EDIT_NAME]: () => require('../../../../pages/GroupChatNameEditPage').default, }); const NewTaskModalStackNavigator = createModalStackNavigator({ - [SCREENS.NEW_TASK.ROOT]: () => require('../../../../pages/tasks/NewTaskPage').default as React.ComponentType, - [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default as React.ComponentType, - [SCREENS.NEW_TASK.TASK_SHARE_DESTINATION_SELECTOR]: () => require('../../../../pages/tasks/TaskShareDestinationSelectorModal').default as React.ComponentType, - [SCREENS.NEW_TASK.DETAILS]: () => require('../../../../pages/tasks/NewTaskDetailsPage').default as React.ComponentType, - [SCREENS.NEW_TASK.TITLE]: () => require('../../../../pages/tasks/NewTaskTitlePage').default as React.ComponentType, - [SCREENS.NEW_TASK.DESCRIPTION]: () => require('../../../../pages/tasks/NewTaskDescriptionPage').default as React.ComponentType, + [SCREENS.NEW_TASK.ROOT]: () => require('../../../../pages/tasks/NewTaskPage').default, + [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default, + [SCREENS.NEW_TASK.TASK_SHARE_DESTINATION_SELECTOR]: () => require('../../../../pages/tasks/TaskShareDestinationSelectorModal').default, + [SCREENS.NEW_TASK.DETAILS]: () => require('../../../../pages/tasks/NewTaskDetailsPage').default, + [SCREENS.NEW_TASK.TITLE]: () => require('../../../../pages/tasks/NewTaskTitlePage').default, + [SCREENS.NEW_TASK.DESCRIPTION]: () => require('../../../../pages/tasks/NewTaskDescriptionPage').default, }); const NewTeachersUniteNavigator = createModalStackNavigator({ - [SCREENS.SAVE_THE_WORLD.ROOT]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default as React.ComponentType, - [SCREENS.I_KNOW_A_TEACHER]: () => require('../../../../pages/TeachersUnite/KnowATeacherPage').default as React.ComponentType, - [SCREENS.INTRO_SCHOOL_PRINCIPAL]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default as React.ComponentType, - [SCREENS.I_AM_A_TEACHER]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default as React.ComponentType, + [SCREENS.SAVE_THE_WORLD.ROOT]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default, + [SCREENS.I_KNOW_A_TEACHER]: () => require('../../../../pages/TeachersUnite/KnowATeacherPage').default, + [SCREENS.INTRO_SCHOOL_PRINCIPAL]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default, + [SCREENS.I_AM_A_TEACHER]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default, }); const SettingsModalStackNavigator = createModalStackNavigator({ - [SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../../pages/ShareCodePage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.PRONOUNS]: () => require('../../../../pages/settings/Profile/PronounsPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.DISPLAY_NAME]: () => require('../../../../pages/settings/Profile/DisplayNamePage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.TIMEZONE]: () => require('../../../../pages/settings/Profile/TimezoneInitialPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.TIMEZONE_SELECT]: () => require('../../../../pages/settings/Profile/TimezoneSelectPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.LEGAL_NAME]: () => require('../../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.DATE_OF_BIRTH]: () => require('../../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.ADDRESS_COUNTRY]: () => require('../../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.ADDRESS_STATE]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodsPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../../pages/settings/Profile/Contacts/NewContactMethodPage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: () => require('../../../../pages/settings/Preferences/PriorityModePage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require('../../../../pages/settings/Preferences/LanguagePage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES.THEME]: () => require('../../../../pages/settings/Preferences/ThemePage').default as React.ComponentType, - [SCREENS.SETTINGS.CLOSE]: () => require('../../../../pages/settings/Security/CloseAccountPage').default as React.ComponentType, - [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require('../../../../pages/settings/AppDownloadLinks').default as React.ComponentType, - [SCREENS.SETTINGS.CONSOLE]: () => require('../../../../pages/settings/AboutPage/ConsolePage').default as React.ComponentType, - [SCREENS.SETTINGS.SHARE_LOG]: () => require('../../../../pages/settings/AboutPage/ShareLogPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: () => require('../../../../pages/settings/Wallet/ExpensifyCardPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: () => require('../../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: () => require('../../../../pages/settings/Wallet/ActivatePhysicalCardPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.NAME]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardName').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.PHONE]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardPhone').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.ADDRESS]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardAddress').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: () => require('../../../../pages/settings/Wallet/TransferBalancePage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../../pages/settings/Wallet/ChooseTransferAccountPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePayments').default as React.ComponentType, - [SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType, - [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.STATUS]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusClearAfterPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_DATE]: () => require('../../../../pages/settings/Profile/CustomStatus/SetDatePage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_TIME]: () => require('../../../../pages/settings/Profile/CustomStatus/SetTimePage').default as React.ComponentType, - [SCREENS.SETTINGS.SUBSCRIPTION.SIZE]: () => require('../../../../pages/settings/Subscription/SubscriptionSize').default as React.ComponentType, - [SCREENS.SETTINGS.SUBSCRIPTION.DISABLE_AUTO_RENEW_SURVEY]: () => require('../../../../pages/settings/Subscription/DisableAutoRenewSurveyPage').default as React.ComponentType, - [SCREENS.WORKSPACE.RATE_AND_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage').default as React.ComponentType, - [SCREENS.WORKSPACE.RATE_AND_UNIT_RATE]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage').default as React.ComponentType, - [SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage').default as React.ComponentType, - [SCREENS.WORKSPACE.INVITE]: () => require('../../../../pages/workspace/WorkspaceInvitePage').default as React.ComponentType, - [SCREENS.WORKSPACE.WORKFLOWS_APPROVER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsApproverPage').default as React.ComponentType, - [SCREENS.WORKSPACE.INVITE_MESSAGE]: () => require('../../../../pages/workspace/WorkspaceInviteMessagePage').default as React.ComponentType, - [SCREENS.WORKSPACE.WORKFLOWS_PAYER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPayerPage').default as React.ComponentType, - [SCREENS.WORKSPACE.NAME]: () => require('../../../../pages/workspace/WorkspaceNamePage').default as React.ComponentType, - [SCREENS.WORKSPACE.DESCRIPTION]: () => require('../../../../pages/workspace/WorkspaceProfileDescriptionPage').default as React.ComponentType, - [SCREENS.WORKSPACE.SHARE]: () => require('../../../../pages/workspace/WorkspaceProfileSharePage').default as React.ComponentType, - [SCREENS.WORKSPACE.CURRENCY]: () => require('../../../../pages/workspace/WorkspaceProfileCurrencyPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ADDRESS]: () => require('../../../../pages/workspace/WorkspaceProfileAddressPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.MEMBER_DETAILS]: () => require('../../../../pages/workspace/members/WorkspaceMemberDetailsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.OWNER_CHANGE_CHECK]: () => require('@pages/workspace/members/WorkspaceOwnerChangeWrapperPage').default as React.ComponentType, - [SCREENS.WORKSPACE.OWNER_CHANGE_SUCCESS]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeSuccessPage').default as React.ComponentType, - [SCREENS.WORKSPACE.OWNER_CHANGE_ERROR]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeErrorPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CREATE_DISTANCE_RATE]: () => require('../../../../pages/workspace/distanceRates/CreateDistanceRatePage').default as React.ComponentType, - [SCREENS.WORKSPACE.DISTANCE_RATES_SETTINGS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.DISTANCE_RATE_DETAILS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateDetailsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.DISTANCE_RATE_EDIT]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateEditPage').default as React.ComponentType, + [SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../../pages/ShareCodePage').default, + [SCREENS.SETTINGS.PROFILE.PRONOUNS]: () => require('../../../../pages/settings/Profile/PronounsPage').default, + [SCREENS.SETTINGS.PROFILE.DISPLAY_NAME]: () => require('../../../../pages/settings/Profile/DisplayNamePage').default, + [SCREENS.SETTINGS.PROFILE.TIMEZONE]: () => require('../../../../pages/settings/Profile/TimezoneInitialPage').default, + [SCREENS.SETTINGS.PROFILE.TIMEZONE_SELECT]: () => require('../../../../pages/settings/Profile/TimezoneSelectPage').default, + [SCREENS.SETTINGS.PROFILE.LEGAL_NAME]: () => require('../../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default, + [SCREENS.SETTINGS.PROFILE.DATE_OF_BIRTH]: () => require('../../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default, + [SCREENS.SETTINGS.PROFILE.ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default, + [SCREENS.SETTINGS.PROFILE.ADDRESS_COUNTRY]: () => require('../../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default, + [SCREENS.SETTINGS.PROFILE.ADDRESS_STATE]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default, + [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodsPage').default, + [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default, + [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../../pages/settings/Profile/Contacts/NewContactMethodPage').default, + [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: () => require('../../../../pages/settings/Preferences/PriorityModePage').default, + [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, + [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require('../../../../pages/settings/Preferences/LanguagePage').default, + [SCREENS.SETTINGS.PREFERENCES.THEME]: () => require('../../../../pages/settings/Preferences/ThemePage').default, + [SCREENS.SETTINGS.CLOSE]: () => require('../../../../pages/settings/Security/CloseAccountPage').default, + [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require('../../../../pages/settings/AppDownloadLinks').default, + [SCREENS.SETTINGS.CONSOLE]: () => require('../../../../pages/settings/AboutPage/ConsolePage').default, + [SCREENS.SETTINGS.SHARE_LOG]: () => require('../../../../pages/settings/AboutPage/ShareLogPage').default, + [SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default, + [SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: () => require('../../../../pages/settings/Wallet/ExpensifyCardPage').default, + [SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: () => require('../../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default, + [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: () => require('../../../../pages/settings/Wallet/ActivatePhysicalCardPage').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.NAME]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardName').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.PHONE]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardPhone').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.ADDRESS]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardAddress').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default, + [SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: () => require('../../../../pages/settings/Wallet/TransferBalancePage').default, + [SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../../pages/settings/Wallet/ChooseTransferAccountPage').default, + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePayments').default, + [SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default, + [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.SETTINGS.PROFILE.STATUS]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusPage').default, + [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusClearAfterPage').default, + [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_DATE]: () => require('../../../../pages/settings/Profile/CustomStatus/SetDatePage').default, + [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_TIME]: () => require('../../../../pages/settings/Profile/CustomStatus/SetTimePage').default, + [SCREENS.SETTINGS.SUBSCRIPTION.SIZE]: () => require('../../../../pages/settings/Subscription/SubscriptionSize').default, + [SCREENS.SETTINGS.SUBSCRIPTION.DISABLE_AUTO_RENEW_SURVEY]: () => require('../../../../pages/settings/Subscription/DisableAutoRenewSurveyPage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT_RATE]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage').default, + [SCREENS.WORKSPACE.INVITE]: () => require('../../../../pages/workspace/WorkspaceInvitePage').default, + [SCREENS.WORKSPACE.WORKFLOWS_APPROVER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsApproverPage').default, + [SCREENS.WORKSPACE.INVITE_MESSAGE]: () => require('../../../../pages/workspace/WorkspaceInviteMessagePage').default, + [SCREENS.WORKSPACE.WORKFLOWS_PAYER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPayerPage').default, + [SCREENS.WORKSPACE.NAME]: () => require('../../../../pages/workspace/WorkspaceNamePage').default, + [SCREENS.WORKSPACE.DESCRIPTION]: () => require('../../../../pages/workspace/WorkspaceProfileDescriptionPage').default, + [SCREENS.WORKSPACE.SHARE]: () => require('../../../../pages/workspace/WorkspaceProfileSharePage').default, + [SCREENS.WORKSPACE.CURRENCY]: () => require('../../../../pages/workspace/WorkspaceProfileCurrencyPage').default, + [SCREENS.WORKSPACE.CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default, + [SCREENS.WORKSPACE.ADDRESS]: () => require('../../../../pages/workspace/WorkspaceProfileAddressPage').default, + [SCREENS.WORKSPACE.CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default, + [SCREENS.WORKSPACE.MEMBER_DETAILS]: () => require('../../../../pages/workspace/members/WorkspaceMemberDetailsPage').default, + [SCREENS.WORKSPACE.OWNER_CHANGE_CHECK]: () => require('@pages/workspace/members/WorkspaceOwnerChangeWrapperPage').default, + [SCREENS.WORKSPACE.OWNER_CHANGE_SUCCESS]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeSuccessPage').default, + [SCREENS.WORKSPACE.OWNER_CHANGE_ERROR]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeErrorPage').default, + [SCREENS.WORKSPACE.CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default, + [SCREENS.WORKSPACE.CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default, + [SCREENS.WORKSPACE.CREATE_DISTANCE_RATE]: () => require('../../../../pages/workspace/distanceRates/CreateDistanceRatePage').default, + [SCREENS.WORKSPACE.DISTANCE_RATES_SETTINGS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATE_DETAILS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateDetailsPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATE_EDIT]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateEditPage').default, [SCREENS.WORKSPACE.DISTANCE_RATE_TAX_RECLAIMABLE_ON_EDIT]: () => - require('../../../../pages/workspace/distanceRates/PolicyDistanceRateTaxReclaimableEditPage').default as React.ComponentType, - [SCREENS.WORKSPACE.DISTANCE_RATE_TAX_RATE_EDIT]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateTaxRateEditPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAGS_SETTINGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAG_SETTINGS]: () => require('../../../../pages/workspace/tags/TagSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAG_LIST_VIEW]: () => require('../../../../pages/workspace/tags/WorkspaceViewTagsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAGS_EDIT]: () => require('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAG_CREATE]: () => require('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAG_EDIT]: () => require('../../../../pages/workspace/tags/EditTagPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES_SETTINGS]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES_SETTINGS_CUSTOM_TAX_NAME]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, + require('../../../../pages/workspace/distanceRates/PolicyDistanceRateTaxReclaimableEditPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATE_TAX_RATE_EDIT]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateTaxRateEditPage').default, + [SCREENS.WORKSPACE.TAGS_SETTINGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsSettingsPage').default, + [SCREENS.WORKSPACE.TAG_SETTINGS]: () => require('../../../../pages/workspace/tags/TagSettingsPage').default, + [SCREENS.WORKSPACE.TAG_LIST_VIEW]: () => require('../../../../pages/workspace/tags/WorkspaceViewTagsPage').default, + [SCREENS.WORKSPACE.TAGS_EDIT]: () => require('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default, + [SCREENS.WORKSPACE.TAG_CREATE]: () => require('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default, + [SCREENS.WORKSPACE.TAG_EDIT]: () => require('../../../../pages/workspace/tags/EditTagPage').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsPage').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS_CUSTOM_TAX_NAME]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_NON_REIMBURSABLE_DEFAULT_VENDOR_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableDefaultVendorSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableDefaultVendorSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => - require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default as React.ComponentType, + require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_COMPANY_CARD_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default as React.ComponentType, - [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, - [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, - [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default as React.ComponentType, - [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: () => require('../../../../pages/settings/Wallet/ReportCardLostPage').default as React.ComponentType, - [SCREENS.KEYBOARD_SHORTCUTS]: () => require('../../../../pages/KeyboardShortcutsPage').default as React.ComponentType, - [SCREENS.SETTINGS.EXIT_SURVEY.REASON]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyReasonPage').default as React.ComponentType, - [SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyResponsePage').default as React.ComponentType, - [SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyConfirmPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksImportPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default, + [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, + [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default, + [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default, + [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: () => require('../../../../pages/settings/Wallet/ReportCardLostPage').default, + [SCREENS.KEYBOARD_SHORTCUTS]: () => require('../../../../pages/KeyboardShortcutsPage').default, + [SCREENS.SETTINGS.EXIT_SURVEY.REASON]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyReasonPage').default, + [SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyResponsePage').default, + [SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyConfirmPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksImportPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS]: () => - require('../../../../pages/workspace/accounting/qbo/import/QuickbooksChartOfAccountsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksCustomersPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksTaxesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksLocationsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CLASSES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksClassesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED]: () => require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAdvancedPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/import/QuickbooksChartOfAccountsPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksCustomersPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksTaxesPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksLocationsPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CLASSES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksClassesPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED]: () => require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAdvancedPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAccountSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksInvoiceAccountSelectPage').default as React.ComponentType, - - [SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT]: () => require('../../../../pages/workspace/accounting/xero/XeroImportPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: () => require('../../../../pages/workspace/accounting/xero/XeroOrganizationConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_CHART_OF_ACCOUNTS]: () => require('../../../../pages/workspace/accounting/xero/import/XeroChartOfAccountsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_CUSTOMER]: () => require('../../../../pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: () => require('../../../../pages/workspace/accounting/xero/XeroTaxesConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_TRACKING_CATEGORIES]: () => - require('../../../../pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksInvoiceAccountSelectPage').default, + + [SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT]: () => require('../../../../pages/workspace/accounting/xero/XeroImportPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: () => require('../../../../pages/workspace/accounting/xero/XeroOrganizationConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_CHART_OF_ACCOUNTS]: () => require('../../../../pages/workspace/accounting/xero/import/XeroChartOfAccountsPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_CUSTOMER]: () => require('../../../../pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: () => require('../../../../pages/workspace/accounting/xero/XeroTaxesConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_TRACKING_CATEGORIES]: () => require('../../../../pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_MAP_TRACKING_CATEGORY]: () => - require('../../../../pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: () => require('../../../../pages/workspace/accounting/xero/export/XeroExportConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: () => require('../../../../pages/workspace/accounting/xero/export/XeroExportConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PURCHASE_BILL_DATE_SELECT]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillDateSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillDateSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_BANK_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroBankAccountSelectPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: () => require('../../../../pages/workspace/accounting/xero/advanced/XeroAdvancedPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/export/XeroBankAccountSelectPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: () => require('../../../../pages/workspace/accounting/xero/advanced/XeroAdvancedPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_STATUS_SELECTOR]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillStatusSelectorPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillStatusSelectorPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/xero/advanced/XeroInvoiceAccountSelectorPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/advanced/XeroInvoiceAccountSelectorPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/xero/advanced/XeroBillPaymentAccountSelectorPage').default as React.ComponentType, - [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default as React.ComponentType, - [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () => - require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAX_EDIT]: () => require('../../../../pages/workspace/taxes/WorkspaceEditTaxPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAX_NAME]: () => require('../../../../pages/workspace/taxes/NamePage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAX_VALUE]: () => require('../../../../pages/workspace/taxes/ValuePage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAX_CREATE]: () => require('../../../../pages/workspace/taxes/WorkspaceCreateTaxPage').default as React.ComponentType, - [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default as React.ComponentType, - [SCREENS.SETTINGS.SUBSCRIPTION.ADD_PAYMENT_CARD]: () => require('../../../../pages/settings/Subscription/PaymentCard/AddPaymentCard').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/advanced/XeroBillPaymentAccountSelectorPage').default, + [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default, + [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default, + [SCREENS.WORKSPACE.TAX_EDIT]: () => require('../../../../pages/workspace/taxes/WorkspaceEditTaxPage').default, + [SCREENS.WORKSPACE.TAX_NAME]: () => require('../../../../pages/workspace/taxes/NamePage').default, + [SCREENS.WORKSPACE.TAX_VALUE]: () => require('../../../../pages/workspace/taxes/ValuePage').default, + [SCREENS.WORKSPACE.TAX_CREATE]: () => require('../../../../pages/workspace/taxes/WorkspaceCreateTaxPage').default, + [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default, + [SCREENS.SETTINGS.SUBSCRIPTION.ADD_PAYMENT_CARD]: () => require('../../../../pages/settings/Subscription/PaymentCard/AddPaymentCard').default, }); const EnablePaymentsStackNavigator = createModalStackNavigator({ - [SCREENS.ENABLE_PAYMENTS_ROOT]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType, + [SCREENS.ENABLE_PAYMENTS_ROOT]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, }); const AddPersonalBankAccountModalStackNavigator = createModalStackNavigator({ - [SCREENS.ADD_PERSONAL_BANK_ACCOUNT_ROOT]: () => require('../../../../pages/AddPersonalBankAccountPage').default as React.ComponentType, + [SCREENS.ADD_PERSONAL_BANK_ACCOUNT_ROOT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, }); const ReimbursementAccountModalStackNavigator = createModalStackNavigator({ - [SCREENS.REIMBURSEMENT_ACCOUNT_ROOT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, + [SCREENS.REIMBURSEMENT_ACCOUNT_ROOT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, }); const WalletStatementStackNavigator = createModalStackNavigator({ - [SCREENS.WALLET_STATEMENT_ROOT]: () => require('../../../../pages/wallet/WalletStatementPage').default as React.ComponentType, + [SCREENS.WALLET_STATEMENT_ROOT]: () => require('../../../../pages/wallet/WalletStatementPage').default, }); const FlagCommentStackNavigator = createModalStackNavigator({ - [SCREENS.FLAG_COMMENT_ROOT]: () => require('../../../../pages/FlagCommentPage').default as React.ComponentType, + [SCREENS.FLAG_COMMENT_ROOT]: () => require('../../../../pages/FlagCommentPage').default, }); const EditRequestStackNavigator = createModalStackNavigator({ - [SCREENS.EDIT_REQUEST.REPORT_FIELD]: () => require('../../../../pages/EditReportFieldPage').default as React.ComponentType, + [SCREENS.EDIT_REQUEST.REPORT_FIELD]: () => require('../../../../pages/EditReportFieldPage').default, }); const PrivateNotesModalStackNavigator = createModalStackNavigator({ - [SCREENS.PRIVATE_NOTES.LIST]: () => require('../../../../pages/PrivateNotes/PrivateNotesListPage').default as React.ComponentType, - [SCREENS.PRIVATE_NOTES.EDIT]: () => require('../../../../pages/PrivateNotes/PrivateNotesEditPage').default as React.ComponentType, + [SCREENS.PRIVATE_NOTES.LIST]: () => require('../../../../pages/PrivateNotes/PrivateNotesListPage').default, + [SCREENS.PRIVATE_NOTES.EDIT]: () => require('../../../../pages/PrivateNotes/PrivateNotesEditPage').default, }); const SignInModalStackNavigator = createModalStackNavigator({ - [SCREENS.SIGN_IN_ROOT]: () => require('../../../../pages/signin/SignInModal').default as React.ComponentType, + [SCREENS.SIGN_IN_ROOT]: () => require('../../../../pages/signin/SignInModal').default, }); const ReferralModalStackNavigator = createModalStackNavigator({ - [SCREENS.REFERRAL_DETAILS]: () => require('../../../../pages/ReferralDetailsPage').default as React.ComponentType, + [SCREENS.REFERRAL_DETAILS]: () => require('../../../../pages/ReferralDetailsPage').default, }); const ProcessMoneyRequestHoldStackNavigator = createModalStackNavigator({ - [SCREENS.PROCESS_MONEY_REQUEST_HOLD_ROOT]: () => require('../../../../pages/ProcessMoneyRequestHoldPage').default as React.ComponentType, + [SCREENS.PROCESS_MONEY_REQUEST_HOLD_ROOT]: () => require('../../../../pages/ProcessMoneyRequestHoldPage').default, }); const TransactionDuplicateStackNavigator = createModalStackNavigator({ - [SCREENS.TRANSACTION_DUPLICATE.REVIEW]: () => require('../../../../pages/TransactionDuplicate/Review').default as React.ComponentType, + [SCREENS.TRANSACTION_DUPLICATE.REVIEW]: () => require('../../../../pages/TransactionDuplicate/Review').default, }); const SearchReportModalStackNavigator = createModalStackNavigator({ - [SCREENS.SEARCH.REPORT_RHP]: () => require('../../../../pages/home/ReportScreen').default as React.ComponentType, + [SCREENS.SEARCH.REPORT_RHP]: () => require('../../../../pages/home/ReportScreen').default, }); const RestrictedActionModalStackNavigator = createModalStackNavigator({ - [SCREENS.RESTRICTED_ACTION_ROOT]: () => require('../../../../pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage').default as React.ComponentType, + [SCREENS.RESTRICTED_ACTION_ROOT]: () => require('../../../../pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage').default, }); export { diff --git a/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx index 6e1d154ff350..46212f3bc41f 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx @@ -7,10 +7,10 @@ import type {BottomTabNavigatorParamList, CentralPaneName, NavigationPartialRout import SidebarScreen from '@pages/home/sidebar/SidebarScreen'; import SearchPageBottomTab from '@pages/Search/SearchPageBottomTab'; import SCREENS from '@src/SCREENS'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import ActiveRouteContext from './ActiveRouteContext'; -const loadInitialSettingsPage = () => require('../../../../pages/settings/InitialSettingsPage').default as React.ComponentType; - +const loadInitialSettingsPage = () => require('../../../../pages/settings/InitialSettingsPage').default; const Tab = createCustomBottomTabNavigator(); const screenOptions: StackNavigationOptions = { diff --git a/src/libs/Navigation/AppNavigator/Navigators/CentralPaneNavigator/BaseCentralPaneNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/CentralPaneNavigator/BaseCentralPaneNavigator.tsx index 8881ce3517c6..5c833a603fb7 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/CentralPaneNavigator/BaseCentralPaneNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/CentralPaneNavigator/BaseCentralPaneNavigator.tsx @@ -7,6 +7,7 @@ import type {CentralPaneNavigatorParamList} from '@navigation/types'; import SearchPage from '@pages/Search/SearchPage'; import CONST from '@src/CONST'; import SCREENS from '@src/SCREENS'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; const Stack = createStackNavigator(); @@ -16,15 +17,15 @@ const openOnAdminRoom = url ? new URL(url).searchParams.get('openOnAdminRoom') : type Screens = Partial React.ComponentType>>; const settingsScreens = { - [SCREENS.SETTINGS.WORKSPACES]: () => require('../../../../../pages/workspace/WorkspacesListPage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES.ROOT]: () => require('../../../../../pages/settings/Preferences/PreferencesPage').default as React.ComponentType, - [SCREENS.SETTINGS.SECURITY]: () => require('../../../../../pages/settings/Security/SecuritySettingsPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.ROOT]: () => require('../../../../../pages/settings/Profile/ProfilePage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.ROOT]: () => require('../../../../../pages/settings/Wallet/WalletPage').default as React.ComponentType, - [SCREENS.SETTINGS.ABOUT]: () => require('../../../../../pages/settings/AboutPage/AboutPage').default as React.ComponentType, - [SCREENS.SETTINGS.TROUBLESHOOT]: () => require('../../../../../pages/settings/Troubleshoot/TroubleshootPage').default as React.ComponentType, - [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../../pages/TeachersUnite/SaveTheWorldPage').default as React.ComponentType, - [SCREENS.SETTINGS.SUBSCRIPTION.ROOT]: () => require('../../../../../pages/settings/Subscription/SubscriptionSettingsPage').default as React.ComponentType, + [SCREENS.SETTINGS.WORKSPACES]: () => require('../../../../../pages/workspace/WorkspacesListPage').default, + [SCREENS.SETTINGS.PREFERENCES.ROOT]: () => require('../../../../../pages/settings/Preferences/PreferencesPage').default, + [SCREENS.SETTINGS.SECURITY]: () => require('../../../../../pages/settings/Security/SecuritySettingsPage').default, + [SCREENS.SETTINGS.PROFILE.ROOT]: () => require('../../../../../pages/settings/Profile/ProfilePage').default, + [SCREENS.SETTINGS.WALLET.ROOT]: () => require('../../../../../pages/settings/Wallet/WalletPage').default, + [SCREENS.SETTINGS.ABOUT]: () => require('../../../../../pages/settings/AboutPage/AboutPage').default, + [SCREENS.SETTINGS.TROUBLESHOOT]: () => require('../../../../../pages/settings/Troubleshoot/TroubleshootPage').default, + [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../../pages/TeachersUnite/SaveTheWorldPage').default, + [SCREENS.SETTINGS.SUBSCRIPTION.ROOT]: () => require('../../../../../pages/settings/Subscription/SubscriptionSettingsPage').default, } satisfies Screens; function BaseCentralPaneNavigator() { diff --git a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx index f8c69fb6c218..82c5c3fcd855 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx @@ -8,29 +8,30 @@ import createCustomFullScreenNavigator from '@libs/Navigation/AppNavigator/creat import getRootNavigatorScreenOptions from '@libs/Navigation/AppNavigator/getRootNavigatorScreenOptions'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import SCREENS from '@src/SCREENS'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; -const loadWorkspaceInitialPage = () => require('../../../../pages/workspace/WorkspaceInitialPage').default as React.ComponentType; +const loadWorkspaceInitialPage = () => require('../../../../pages/workspace/WorkspaceInitialPage').default; const RootStack = createCustomFullScreenNavigator(); type Screens = Partial React.ComponentType>>; const CENTRAL_PANE_WORKSPACE_SCREENS = { - [SCREENS.WORKSPACE.PROFILE]: () => require('../../../../pages/workspace/WorkspaceProfilePage').default as React.ComponentType, - [SCREENS.WORKSPACE.CARD]: () => require('../../../../pages/workspace/card/WorkspaceCardPage').default as React.ComponentType, - [SCREENS.WORKSPACE.WORKFLOWS]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../../pages/workspace/reimburse/WorkspaceReimbursePage').default as React.ComponentType, - [SCREENS.WORKSPACE.BILLS]: () => require('../../../../pages/workspace/bills/WorkspaceBillsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.INVOICES]: () => require('../../../../pages/workspace/invoices/WorkspaceInvoicesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TRAVEL]: () => require('../../../../pages/workspace/travel/WorkspaceTravelPage').default as React.ComponentType, - [SCREENS.WORKSPACE.MEMBERS]: () => require('../../../../pages/workspace/WorkspaceMembersPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORIES]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.MORE_FEATURES]: () => require('../../../../pages/workspace/WorkspaceMoreFeaturesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.REPORT_FIELDS]: () => require('../../../../pages/workspace/reportFields/WorkspaceReportFieldsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.DISTANCE_RATES]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesPage').default as React.ComponentType, + [SCREENS.WORKSPACE.PROFILE]: () => require('../../../../pages/workspace/WorkspaceProfilePage').default, + [SCREENS.WORKSPACE.CARD]: () => require('../../../../pages/workspace/card/WorkspaceCardPage').default, + [SCREENS.WORKSPACE.WORKFLOWS]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPage').default, + [SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../../pages/workspace/reimburse/WorkspaceReimbursePage').default, + [SCREENS.WORKSPACE.BILLS]: () => require('../../../../pages/workspace/bills/WorkspaceBillsPage').default, + [SCREENS.WORKSPACE.INVOICES]: () => require('../../../../pages/workspace/invoices/WorkspaceInvoicesPage').default, + [SCREENS.WORKSPACE.TRAVEL]: () => require('../../../../pages/workspace/travel/WorkspaceTravelPage').default, + [SCREENS.WORKSPACE.MEMBERS]: () => require('../../../../pages/workspace/WorkspaceMembersPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, + [SCREENS.WORKSPACE.CATEGORIES]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default, + [SCREENS.WORKSPACE.MORE_FEATURES]: () => require('../../../../pages/workspace/WorkspaceMoreFeaturesPage').default, + [SCREENS.WORKSPACE.TAGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsPage').default, + [SCREENS.WORKSPACE.TAXES]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesPage').default, + [SCREENS.WORKSPACE.REPORT_FIELDS]: () => require('../../../../pages/workspace/reportFields/WorkspaceReportFieldsPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATES]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesPage').default, } satisfies Screens; function FullScreenNavigator() { diff --git a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx index b1cfb8e5d9a1..2aebe9f111f5 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx @@ -9,12 +9,13 @@ import ModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/ModalNavi import type {AuthScreensParamList, LeftModalNavigatorParamList} from '@libs/Navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import Overlay from './Overlay'; type LeftModalNavigatorProps = StackScreenProps; -const loadChatFinder = () => require('../../../../pages/ChatFinderPage').default as React.ComponentType; -const loadWorkspaceSwitcherPage = () => require('../../../../pages/WorkspaceSwitcherPage').default as React.ComponentType; +const loadChatFinder = () => require('../../../../pages/ChatFinderPage').default; +const loadWorkspaceSwitcherPage = () => require('../../../../pages/WorkspaceSwitcherPage').default; const Stack = createStackNavigator(); diff --git a/src/libs/Navigation/AppNavigator/index.native.tsx b/src/libs/Navigation/AppNavigator/index.native.tsx index f740f9eb5b94..e848979e6993 100644 --- a/src/libs/Navigation/AppNavigator/index.native.tsx +++ b/src/libs/Navigation/AppNavigator/index.native.tsx @@ -2,6 +2,7 @@ import React, {memo, useContext, useEffect} from 'react'; import {NativeModules} from 'react-native'; import {InitialURLContext} from '@components/InitialURLContextProvider'; import Navigation from '@libs/Navigation/Navigation'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; type AppNavigatorProps = { /** If we have an authToken this is true */ @@ -22,13 +23,13 @@ function AppNavigator({authenticated}: AppNavigatorProps) { }, [initUrl]); if (authenticated) { - const AuthScreens = require('./AuthScreens').default; + const AuthScreens = require('./AuthScreens').default; // These are the protected screens and only accessible when an authToken is present return ; } - const PublicScreens = require('./PublicScreens').default; + const PublicScreens = require('./PublicScreens').default; return ; } diff --git a/src/libs/Navigation/linkTo/index.ts b/src/libs/Navigation/linkTo/index.ts index 7e49c1613a62..c0085651fdd1 100644 --- a/src/libs/Navigation/linkTo/index.ts +++ b/src/libs/Navigation/linkTo/index.ts @@ -28,6 +28,7 @@ import type {Route} from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; import getActionForBottomTabNavigator from './getActionForBottomTabNavigator'; import getMinimalAction from './getMinimalAction'; +import type {ActionPayloadParams} from './types'; export default function linkTo(navigation: NavigationContainerRef | null, path: Route, type?: string, isActiveRoute?: boolean) { if (!navigation) { @@ -71,16 +72,17 @@ export default function linkTo(navigation: NavigationContainerRef | undefined, (value) => value === undefined), - omitBy(action.payload.params?.params as Record | undefined, (value) => value === undefined), + omitBy(actionParams?.params as Record | undefined, (value) => value === undefined), ); // If this action is navigating to the report screen and the top most navigator is different from the one we want to navigate - PUSH the new screen to the top of the stack by default @@ -108,8 +110,8 @@ export default function linkTo(navigation: NavigationContainerRef).policyIDs = policyID; } // If the type is UP, we deeplinked into one of the RHP flows and we want to replace the current screen with the previous one in the flow diff --git a/src/libs/Network/SequentialQueue.ts b/src/libs/Network/SequentialQueue.ts index 10df3c703c92..5646cb8956dd 100644 --- a/src/libs/Network/SequentialQueue.ts +++ b/src/libs/Network/SequentialQueue.ts @@ -10,6 +10,11 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type OnyxRequest from '@src/types/onyx/Request'; import * as NetworkStore from './NetworkStore'; +type RequestError = Error & { + name?: string; + message?: string; +}; + let resolveIsReadyPromise: ((args?: unknown[]) => void) | undefined; let isReadyPromise = new Promise((resolve) => { resolveIsReadyPromise = resolve; @@ -89,7 +94,7 @@ function process(): Promise { RequestThrottle.clear(); return process(); }) - .catch((error) => { + .catch((error: RequestError) => { // On sign out we cancel any in flight requests from the user. Since that user is no longer signed in their requests should not be retried. // Duplicate records don't need to be retried as they just mean the record already exists on the server if (error.name === CONST.ERROR.REQUEST_CANCELLED || error.message === CONST.ERROR.DUPLICATE_RECORD) { diff --git a/src/libs/NetworkConnection.ts b/src/libs/NetworkConnection.ts index 0b4ca5291689..acdb982c729a 100644 --- a/src/libs/NetworkConnection.ts +++ b/src/libs/NetworkConnection.ts @@ -14,6 +14,10 @@ let isOffline = false; let hasPendingNetworkCheck = false; type NetworkStatus = ValueOf; +type ResponseJSON = { + jsonCode: number; +}; + // Holds all of the callbacks that need to be triggered when the network reconnects let callbackID = 0; const reconnectionCallbacks: Record void> = {}; @@ -113,7 +117,7 @@ function subscribeToNetInfo(): () => void { } return response .json() - .then((json) => Promise.resolve(json.jsonCode === 200)) + .then((json: ResponseJSON) => Promise.resolve(json.jsonCode === 200)) .catch(() => Promise.resolve(false)); }, diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 9290b0dab722..077fb5b72102 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -20,6 +20,7 @@ import type { PersonalDetailsList, Policy, PolicyCategories, + PolicyCategory, PolicyTag, PolicyTagList, PolicyTags, @@ -978,7 +979,7 @@ function getSearchValueForPhoneOrEmail(searchTerm: string) { * Verifies that there is at least one enabled option */ function hasEnabledOptions(options: PolicyCategories | PolicyTag[]): boolean { - return Object.values(options).some((option) => option.enabled && option.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); + return Object.values(options).some((option: PolicyTag | PolicyCategory) => option.enabled && option.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); } /** diff --git a/src/libs/Performance.tsx b/src/libs/Performance.tsx index f5e84b8f6ef3..ef2b08e47229 100644 --- a/src/libs/Performance.tsx +++ b/src/libs/Performance.tsx @@ -86,7 +86,7 @@ const Performance: PerformanceModule = { }; if (Metrics.canCapturePerformanceMetrics()) { - const perfModule: ReactNativePerformance = require('react-native-performance'); + const perfModule = require('react-native-performance'); perfModule.setResourceLoggingEnabled(true); rnPerformance = perfModule.default; diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index f0f85c8f01f3..d6fb70ee177a 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -148,6 +148,10 @@ type GuidedSetupData = Array< AddCommentOrAttachementParams) >; +type ReportError = { + type?: string; +}; + let conciergeChatReportID: string | undefined; let currentUserAccountID = -1; let currentUserEmail: string | undefined; @@ -341,7 +345,7 @@ function subscribeToReportTypingEvents(reportID: string) { Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${reportID}`, typingStoppedStatus); delete typingWatchTimers[reportUserIdentifier]; }, 1500); - }).catch((error) => { + }).catch((error: ReportError) => { Log.hmmm('[Report] Failed to initially subscribe to Pusher channel', {errorType: error.type, pusherChannelName}); }); } @@ -372,7 +376,7 @@ function subscribeToReportLeavingEvents(reportID: string) { } Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_USER_IS_LEAVING_ROOM}${reportID}`, true); - }).catch((error) => { + }).catch((error: ReportError) => { Log.hmmm('[Report] Failed to initially subscribe to Pusher channel', {errorType: error.type, pusherChannelName}); }); } diff --git a/src/libs/fileDownload/index.ios.ts b/src/libs/fileDownload/index.ios.ts index 45e6a5027994..0e6701dbda3a 100644 --- a/src/libs/fileDownload/index.ios.ts +++ b/src/libs/fileDownload/index.ios.ts @@ -94,7 +94,7 @@ const fileDownload: FileDownload = (fileUrl, fileName, successMessage) => FileUtils.showSuccessAlert(successMessage); }) - .catch((err) => { + .catch((err: Error) => { // iOS shows permission popup only once. Subsequent request will only throw an error. // We catch the error and show a redirection link to the settings screen if (err.message === CONST.IOS_CAMERAROLL_ACCESS_ERROR) { diff --git a/src/libs/isPdfFilePasswordProtected/index.tsx b/src/libs/isPdfFilePasswordProtected/index.tsx index 19ce44b9b8e3..f62e080a2a8d 100644 --- a/src/libs/isPdfFilePasswordProtected/index.tsx +++ b/src/libs/isPdfFilePasswordProtected/index.tsx @@ -17,7 +17,7 @@ const isPdfFilePasswordProtected = (file: FileObject): Promise => () => { resolve(false); }, - (error) => { + (error: Error) => { if (error.name === 'PasswordException') { resolve(true); return; diff --git a/src/libs/updateMultilineInputRange/index.ts b/src/libs/updateMultilineInputRange/index.ts index 8bdccd83db90..32a890a8d93f 100644 --- a/src/libs/updateMultilineInputRange/index.ts +++ b/src/libs/updateMultilineInputRange/index.ts @@ -14,8 +14,8 @@ const updateMultilineInputRange: UpdateMultilineInputRange = (input, shouldAutoF return; } - if ('value' in input && input.value && input.setSelectionRange) { - const length = input.value.length as number; + if ('value' in input && typeof input.value === 'string' && input.setSelectionRange) { + const length = input.value.length; if (shouldAutoFocus) { (input as HTMLInputElement).setSelectionRange(length, length); } diff --git a/src/setup/addUtilsToWindow.ts b/src/setup/addUtilsToWindow.ts index eb34d33364eb..9cdbbac06a65 100644 --- a/src/setup/addUtilsToWindow.ts +++ b/src/setup/addUtilsToWindow.ts @@ -45,7 +45,6 @@ export default function addUtilsToWindow() { window.setSupportToken = Session.setSupportAuthToken; // Workaround to give employees the ability to mark reports as read via the JS console - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (window as any).markAllPolicyReportsAsRead = markAllPolicyReportsAsRead; + window.markAllPolicyReportsAsRead = markAllPolicyReportsAsRead; }); } diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 03446e813949..cb3cba68cce5 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -30,4 +30,12 @@ declare module '*.lottie' { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface Window { setSupportToken: (token: string, email: string, accountID: number) => void; + markAllPolicyReportsAsRead: (policyID: string) => void; +} + +// Allows to add generic type in require +// eslint-disable-next-line @typescript-eslint/consistent-type-definitions +interface NodeRequire { + // eslint-disable-next-line @typescript-eslint/prefer-function-type, @typescript-eslint/no-explicit-any + (id: string): T; } diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts index 5fe00ec479cf..43b13a47d3f0 100644 --- a/src/types/modules/act.d.ts +++ b/src/types/modules/act.d.ts @@ -1,8 +1,8 @@ -import type {StepIdentifier as ActStepIdentifier} from '@kie/act-js'; +import type {EventJSON} from '@kie/act-js/build/src/action-event/action-event.types'; +import type {StepIdentifier as ActStepIdentifier, MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; declare module '@kie/act-js' { - // eslint-disable-next-line rulesdir/no-inline-named-export - export declare type StepIdentifier = { + type StepIdentifier = ActStepIdentifier & { id?: string; name: string; run?: string; @@ -10,5 +10,7 @@ declare module '@kie/act-js' { with?: string; envs?: string[]; inputs?: string[]; - } & Omit; + }; + + export type {StepIdentifier, MockStep, EventJSON}; } diff --git a/src/types/utils/ReactComponentModule.ts b/src/types/utils/ReactComponentModule.ts new file mode 100644 index 000000000000..8b40f2cb5c56 --- /dev/null +++ b/src/types/utils/ReactComponentModule.ts @@ -0,0 +1,3 @@ +type ReactComponentModule = {default: React.ComponentType}; + +export default ReactComponentModule; diff --git a/tests/actions/ReportTest.ts b/tests/actions/ReportTest.ts index cc6ad281e72d..e6ab31334bb1 100644 --- a/tests/actions/ReportTest.ts +++ b/tests/actions/ReportTest.ts @@ -186,7 +186,7 @@ describe('actions/Report', () => { .then(() => { // THEN only ONE call to AddComment will happen const URL_ARGUMENT_INDEX = 0; - const addCommentCalls = (global.fetch as jest.Mock).mock.calls.filter((callArguments) => (callArguments[URL_ARGUMENT_INDEX] as string).includes('AddComment')); + const addCommentCalls = (global.fetch as jest.Mock).mock.calls.filter((callArguments: string[]) => callArguments[URL_ARGUMENT_INDEX].includes('AddComment')); expect(addCommentCalls.length).toBe(1); }); }); diff --git a/tests/e2e/testRunner.ts b/tests/e2e/testRunner.ts index a8295f6ddf5c..c8fcaefacb7c 100644 --- a/tests/e2e/testRunner.ts +++ b/tests/e2e/testRunner.ts @@ -30,6 +30,10 @@ import withFailTimeout from './utils/withFailTimeout'; type Result = Record; +type CustomConfig = { + default: unknown; +}; + // VARIABLE CONFIGURATION const args = process.argv.slice(2); const getArg = (argName: string): string | undefined => { @@ -46,7 +50,7 @@ const setConfigPath = (configPathParam: string | undefined) => { if (!configPath?.startsWith('.')) { configPath = `./${configPath}`; } - const customConfig = require(configPath).default; + const customConfig = require(configPath).default; config = Object.assign(defaultConfig, customConfig); }; diff --git a/tests/perf-test/ReportActionsList.perf-test.tsx b/tests/perf-test/ReportActionsList.perf-test.tsx index 96ef3759be23..56973205fe4b 100644 --- a/tests/perf-test/ReportActionsList.perf-test.tsx +++ b/tests/perf-test/ReportActionsList.perf-test.tsx @@ -14,18 +14,22 @@ import ReportActionsList from '@src/pages/home/report/ReportActionsList'; import {ReportAttachmentsProvider} from '@src/pages/home/report/ReportAttachmentsContext'; import {ActionListContext, ReactionListContext} from '@src/pages/home/ReportScreenContext'; import variables from '@src/styles/variables'; +import type {PersonalDetailsList} from '@src/types/onyx'; import createRandomReportAction from '../utils/collections/reportActions'; import * as LHNTestUtilsModule from '../utils/LHNTestUtils'; import * as ReportTestUtils from '../utils/ReportTestUtils'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; import wrapOnyxWithWaitForBatchedUpdates from '../utils/wrapOnyxWithWaitForBatchedUpdates'; +type LazyLoadLHNTestUtils = { + fakePersonalDetails: PersonalDetailsList; +}; + const mockedNavigate = jest.fn(); jest.mock('@components/withCurrentUserPersonalDetails', () => { // Lazy loading of LHNTestUtils - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - const lazyLoadLHNTestUtils = () => require('../utils/LHNTestUtils'); + const lazyLoadLHNTestUtils = () => require('../utils/LHNTestUtils'); return (Component: ComponentType) => { function WrappedComponent(props: Omit) { diff --git a/tests/perf-test/ReportScreen.perf-test.tsx b/tests/perf-test/ReportScreen.perf-test.tsx index 99040200349c..fb011f9a1144 100644 --- a/tests/perf-test/ReportScreen.perf-test.tsx +++ b/tests/perf-test/ReportScreen.perf-test.tsx @@ -2,6 +2,7 @@ import type {StackNavigationProp, StackScreenProps} from '@react-navigation/stac import {screen} from '@testing-library/react-native'; import type {ComponentType} from 'react'; import React from 'react'; +import type ReactNative from 'react-native'; import {Dimensions, InteractionManager} from 'react-native'; import Onyx from 'react-native-onyx'; import type Animated from 'react-native-reanimated'; @@ -50,7 +51,7 @@ jest.mock('react-native/Libraries/Interaction/InteractionManager', () => ({ })); jest.mock('react-native', () => { - const actualReactNative = jest.requireActual('react-native'); + const actualReactNative = jest.requireActual('react-native'); // eslint-disable-next-line @typescript-eslint/no-unsafe-return return { ...actualReactNative, diff --git a/tests/ui/UnreadIndicatorsTest.tsx b/tests/ui/UnreadIndicatorsTest.tsx index 130077d0f017..0faa9ef02d76 100644 --- a/tests/ui/UnreadIndicatorsTest.tsx +++ b/tests/ui/UnreadIndicatorsTest.tsx @@ -5,7 +5,7 @@ import {addSeconds, format, subMinutes, subSeconds} from 'date-fns'; import {utcToZonedTime} from 'date-fns-tz'; import React from 'react'; import {AppState, DeviceEventEmitter, Linking} from 'react-native'; -import type {ViewStyle} from 'react-native'; +import type {TextStyle, ViewStyle} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import type Animated from 'react-native-reanimated'; @@ -92,19 +92,18 @@ const createAddListenerMock = (): ListenerMock => { }; jest.mock('@react-navigation/native', () => { - const actualNav = jest.requireActual('@react-navigation/native'); + const actualNav: jest.Mocked = jest.requireActual('@react-navigation/native'); const {triggerTransitionEnd, addListener} = createAddListenerMock(); transitionEndCB = triggerTransitionEnd; - const useNavigation = () => - ({ - navigate: jest.fn(), - ...actualNav.useNavigation, - getState: () => ({ - routes: [], - }), - addListener, - } as typeof NativeNavigation.useNavigation); + const useNavigation = () => ({ + ...actualNav.useNavigation(), + navigate: jest.fn(), + getState: () => ({ + routes: [], + }), + addListener, + }); return { ...actualNav, @@ -304,7 +303,7 @@ describe('Unread Indicators', () => { // And that the text is bold const displayNameHintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameText = screen.queryByLabelText(displayNameHintText); - expect(displayNameText?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((displayNameText?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); return navigateToSidebarOption(0); }) @@ -442,11 +441,11 @@ describe('Unread Indicators', () => { const displayNameTexts = screen.queryAllByLabelText(displayNameHintTexts); expect(displayNameTexts).toHaveLength(2); const firstReportOption = displayNameTexts[0]; - expect(firstReportOption?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((firstReportOption?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); expect(screen.getByText('C User')).toBeOnTheScreen(); const secondReportOption = displayNameTexts[1]; - expect(secondReportOption?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((secondReportOption?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); expect(screen.getByText('B User')).toBeOnTheScreen(); // Tap the new report option and navigate back to the sidebar again via the back button @@ -459,9 +458,9 @@ describe('Unread Indicators', () => { const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameTexts = screen.queryAllByLabelText(hintText); expect(displayNameTexts).toHaveLength(2); - expect(displayNameTexts[0]?.props?.style?.fontWeight).toBe(undefined); + expect((displayNameTexts[0]?.props?.style as TextStyle)?.fontWeight).toBe(undefined); expect(screen.getAllByText('C User')[0]).toBeOnTheScreen(); - expect(displayNameTexts[1]?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((displayNameTexts[1]?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); expect(screen.getByText('B User')).toBeOnTheScreen(); })); @@ -493,7 +492,7 @@ describe('Unread Indicators', () => { const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameTexts = screen.queryAllByLabelText(hintText); expect(displayNameTexts).toHaveLength(1); - expect(displayNameTexts[0]?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((displayNameTexts[0]?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); expect(screen.getByText('B User')).toBeOnTheScreen(); // Navigate to the report again and back to the sidebar @@ -505,7 +504,7 @@ describe('Unread Indicators', () => { const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameTexts = screen.queryAllByLabelText(hintText); expect(displayNameTexts).toHaveLength(1); - expect(displayNameTexts[0]?.props?.style?.fontWeight).toBe(undefined); + expect((displayNameTexts[0]?.props?.style as TextStyle)?.fontWeight).toBe(undefined); expect(screen.getByText('B User')).toBeOnTheScreen(); // Navigate to the report again and verify the new line indicator is missing diff --git a/tests/unit/CIGitLogicTest.ts b/tests/unit/CIGitLogicTest.ts index cd98891f1f61..83cfb05447b5 100644 --- a/tests/unit/CIGitLogicTest.ts +++ b/tests/unit/CIGitLogicTest.ts @@ -9,6 +9,7 @@ import {execSync} from 'child_process'; import fs from 'fs'; import os from 'os'; import path from 'path'; +import type {PackageJson} from 'type-fest'; import getPreviousVersion from '@github/actions/javascript/getPreviousVersion/getPreviousVersion'; import CONST from '@github/libs/CONST'; import GitUtils from '@github/libs/GitUtils'; @@ -49,8 +50,14 @@ function setupGitAsOSBotify() { exec('git config --local user.email infra+osbotify@expensify.com'); } -function getVersion() { - return JSON.parse(fs.readFileSync('package.json', {encoding: 'utf-8'})).version as string; +function getVersion(): string { + const packageJson = JSON.parse(fs.readFileSync('package.json', {encoding: 'utf-8'})) as PackageJson; + + if (!packageJson.version) { + throw new Error('package.json does not contain a version field'); + } + + return packageJson.version; } function initGitServer() { diff --git a/tests/unit/MiddlewareTest.ts b/tests/unit/MiddlewareTest.ts index 6954b22b2706..be13ded01342 100644 --- a/tests/unit/MiddlewareTest.ts +++ b/tests/unit/MiddlewareTest.ts @@ -9,6 +9,8 @@ import ONYXKEYS from '@src/ONYXKEYS'; import * as TestHelper from '../utils/TestHelper'; import waitForNetworkPromises from '../utils/waitForNetworkPromises'; +type FormDataObject = {body: TestHelper.FormData}; + Onyx.init({ keys: ONYXKEYS, }); @@ -49,9 +51,14 @@ describe('Middleware', () => { expect(global.fetch).toHaveBeenCalledTimes(2); expect(global.fetch).toHaveBeenLastCalledWith('https://www.expensify.com.dev/api/AddComment?', expect.anything()); - TestHelper.assertFormDataMatchesObject((global.fetch as jest.Mock).mock.calls[1][1].body as TestHelper.FormData, {reportID: '1234', reportActionID: '5678'}); + TestHelper.assertFormDataMatchesObject(((global.fetch as jest.Mock).mock.calls[1] as FormDataObject[])[1].body, { + reportID: '1234', + reportActionID: '5678', + }); expect(global.fetch).toHaveBeenNthCalledWith(1, 'https://www.expensify.com.dev/api/OpenReport?', expect.anything()); - TestHelper.assertFormDataMatchesObject((global.fetch as jest.Mock).mock.calls[0][1].body as TestHelper.FormData, {reportID: '1234'}); + TestHelper.assertFormDataMatchesObject(((global.fetch as jest.Mock).mock.calls[0] as FormDataObject[])[1].body, { + reportID: '1234', + }); }); test('Request with preexistingReportID', async () => { @@ -93,9 +100,12 @@ describe('Middleware', () => { expect(global.fetch).toHaveBeenCalledTimes(2); expect(global.fetch).toHaveBeenLastCalledWith('https://www.expensify.com.dev/api/AddComment?', expect.anything()); - TestHelper.assertFormDataMatchesObject((global.fetch as jest.Mock).mock.calls[1][1].body as TestHelper.FormData, {reportID: '5555', reportActionID: '5678'}); + TestHelper.assertFormDataMatchesObject(((global.fetch as jest.Mock).mock.calls[1] as FormDataObject[])[1].body, { + reportID: '5555', + reportActionID: '5678', + }); expect(global.fetch).toHaveBeenNthCalledWith(1, 'https://www.expensify.com.dev/api/OpenReport?', expect.anything()); - TestHelper.assertFormDataMatchesObject((global.fetch as jest.Mock).mock.calls[0][1].body as TestHelper.FormData, {reportID: '1234'}); + TestHelper.assertFormDataMatchesObject(((global.fetch as jest.Mock).mock.calls[0] as FormDataObject[])[1].body, {reportID: '1234'}); }); }); }); diff --git a/tests/unit/NetworkTest.ts b/tests/unit/NetworkTest.ts index 78162a942749..e79a7c93c0e5 100644 --- a/tests/unit/NetworkTest.ts +++ b/tests/unit/NetworkTest.ts @@ -16,6 +16,8 @@ import type ReactNativeOnyxMock from '../../__mocks__/react-native-onyx'; import * as TestHelper from '../utils/TestHelper'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; +type OnResolved = (params: {jsonCode?: string | number}) => void; + const Onyx = MockedOnyx as typeof ReactNativeOnyxMock; jest.mock('@src/libs/Log'); @@ -289,7 +291,7 @@ describe('NetworkTests', () => { test('test Failed to fetch error for non-retryable requests resolve with unable to retry jsonCode', () => { // Setup xhr handler that rejects once with a Failed to Fetch global.fetch = jest.fn().mockRejectedValue(new Error(CONST.ERROR.FAILED_TO_FETCH)); - const onResolved = jest.fn(); + const onResolved = jest.fn() as jest.MockedFunction; // Given we have a request made while online return Onyx.set(ONYXKEYS.NETWORK, {isOffline: false}) diff --git a/tests/unit/createOrUpdateStagingDeployTest.ts b/tests/unit/createOrUpdateStagingDeployTest.ts index 2adac21bec51..59ebe9d639cf 100644 --- a/tests/unit/createOrUpdateStagingDeployTest.ts +++ b/tests/unit/createOrUpdateStagingDeployTest.ts @@ -12,6 +12,11 @@ import type {InternalOctokit} from '@github/libs/GithubUtils'; import GithubUtils from '@github/libs/GithubUtils'; import GitUtils from '@github/libs/GitUtils'; +type Arguments = { + issue_number?: number; + labels?: string; +}; + const PATH_TO_PACKAGE_JSON = path.resolve(__dirname, '../../package.json'); jest.mock('fs'); @@ -37,7 +42,7 @@ beforeAll(() => { }, }), ), - update: jest.fn().mockImplementation((arg) => + update: jest.fn().mockImplementation((arg: Arguments) => Promise.resolve({ data: { ...arg, @@ -171,7 +176,7 @@ describe('createOrUpdateStagingDeployCash', () => { return []; }); - mockListIssues.mockImplementation((args) => { + mockListIssues.mockImplementation((args: Arguments) => { if (args.labels === CONST.LABELS.STAGING_DEPLOY) { return {data: [closedStagingDeployCash]}; } @@ -266,7 +271,7 @@ describe('createOrUpdateStagingDeployCash', () => { return []; }); - mockListIssues.mockImplementation((args) => { + mockListIssues.mockImplementation((args: Arguments) => { if (args.labels === CONST.LABELS.STAGING_DEPLOY) { return {data: [openStagingDeployCashBefore, closedStagingDeployCash]}; } @@ -341,7 +346,7 @@ describe('createOrUpdateStagingDeployCash', () => { } return []; }); - mockListIssues.mockImplementation((args) => { + mockListIssues.mockImplementation((args: Arguments) => { if (args.labels === CONST.LABELS.STAGING_DEPLOY) { return {data: [openStagingDeployCashBefore, closedStagingDeployCash]}; } diff --git a/tests/unit/sanitizeStringForJSONParseTest.ts b/tests/unit/sanitizeStringForJSONParseTest.ts index f9e647eb9a2a..e269617d4f24 100644 --- a/tests/unit/sanitizeStringForJSONParseTest.ts +++ b/tests/unit/sanitizeStringForJSONParseTest.ts @@ -1,5 +1,9 @@ import sanitizeStringForJSONParse from '../../.github/libs/sanitizeStringForJSONParse'; +type ParsedJSON = { + key?: string; +}; + // Bad inputs should cause an error to be thrown const badInputs: Array = [null, undefined, 42, true]; @@ -39,14 +43,14 @@ describe('santizeStringForJSONParse', () => { const badJSON = `{"key": "${input}"}`; // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- it's supposed to throw an error expect(() => JSON.parse(badJSON)).toThrow(); - const goodJSON = JSON.parse(`{"key": "${sanitizeStringForJSONParse(input)}"}`); + const goodJSON: ParsedJSON = JSON.parse(`{"key": "${sanitizeStringForJSONParse(input)}"}`); expect(goodJSON.key).toStrictEqual(expectedOutput); }); }); describe.each(validJSONData)('canHandleValidJSON', (input, expectedOutput) => { test('sanitizeStringForJSONParse', () => { - const goodJSON = JSON.parse(`{"key": "${sanitizeStringForJSONParse(input)}"}`); + const goodJSON: ParsedJSON = JSON.parse(`{"key": "${sanitizeStringForJSONParse(input)}"}`); expect(goodJSON.key).toStrictEqual(expectedOutput); }); }); diff --git a/wdyr.ts b/wdyr.ts index 3f49eb4035a0..e5b40bc3b4c7 100644 --- a/wdyr.ts +++ b/wdyr.ts @@ -6,7 +6,7 @@ import Config from 'react-native-config'; const useWDYR = Config?.USE_WDYR === 'true'; if (useWDYR) { - const whyDidYouRender: typeof WhyDidYouRender = require('@welldone-software/why-did-you-render'); + const whyDidYouRender = require('@welldone-software/why-did-you-render'); whyDidYouRender(React, { // Enable tracking in all pure components by default trackAllPureComponents: true, diff --git a/workflow_tests/authorChecklist.test.ts b/workflow_tests/authorChecklist.test.ts index 84509818ff61..a40b183f6d7a 100644 --- a/workflow_tests/authorChecklist.test.ts +++ b/workflow_tests/authorChecklist.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/cherryPick.test.ts b/workflow_tests/cherryPick.test.ts index 56ce851755b6..964be3ec427d 100644 --- a/workflow_tests/cherryPick.test.ts +++ b/workflow_tests/cherryPick.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/failureNotifier.test.ts b/workflow_tests/failureNotifier.test.ts index 07ebb45517b3..772cd5d28050 100644 --- a/workflow_tests/failureNotifier.test.ts +++ b/workflow_tests/failureNotifier.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/lockDeploys.test.ts b/workflow_tests/lockDeploys.test.ts index c9b083b4d804..7ffb4ed87b7a 100644 --- a/workflow_tests/lockDeploys.test.ts +++ b/workflow_tests/lockDeploys.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/mocks/authorChecklistMocks.ts b/workflow_tests/mocks/authorChecklistMocks.ts index 50e90ddae799..34e6b0984e83 100644 --- a/workflow_tests/mocks/authorChecklistMocks.ts +++ b/workflow_tests/mocks/authorChecklistMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import {createMockStep} from '../utils/utils'; // checklist diff --git a/workflow_tests/mocks/cherryPickMocks.ts b/workflow_tests/mocks/cherryPickMocks.ts index c1a33be868d6..13d7ebf95bfd 100644 --- a/workflow_tests/mocks/cherryPickMocks.ts +++ b/workflow_tests/mocks/cherryPickMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import {createMockStep} from '../utils/utils'; // validateactor diff --git a/workflow_tests/platformDeploy.test.ts b/workflow_tests/platformDeploy.test.ts index 0ac68eb6d55b..f3247acd0d14 100644 --- a/workflow_tests/platformDeploy.test.ts +++ b/workflow_tests/platformDeploy.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/preDeploy.test.ts b/workflow_tests/preDeploy.test.ts index 1739fec13815..a69356f84972 100644 --- a/workflow_tests/preDeploy.test.ts +++ b/workflow_tests/preDeploy.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/reviewerChecklist.test.ts b/workflow_tests/reviewerChecklist.test.ts index d70afd31f115..1fea2b60008c 100644 --- a/workflow_tests/reviewerChecklist.test.ts +++ b/workflow_tests/reviewerChecklist.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/test.test.ts b/workflow_tests/test.test.ts index 54beb8235eb7..926abff56bed 100644 --- a/workflow_tests/test.test.ts +++ b/workflow_tests/test.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index dadb85014d01..78be5c5861e6 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -50,11 +50,11 @@ class JobMocker { jobWith = job.with; delete job.with; } - job.steps = mockJob.steps.map((step): StepIdentifier => { - const mockStep: StepIdentifier = { + job.steps = mockJob.steps.map((step) => { + const mockStep = { name: step.name, run: step.mockWith, - }; + } as StepIdentifier; if (step.id) { mockStep.id = step.id; } diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index e88f7ffd8ee5..1fbbd6e3de4c 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -7,8 +7,6 @@ import {exit} from 'process'; import yaml from 'yaml'; import type {YamlMockJob, YamlWorkflow} from './JobMocker'; -type Step = {name: string; with?: string; envs?: string[]; inputs?: string[]}; - const workflowsDirectory = path.resolve(__dirname, '..', '..', '.github', 'workflows'); const workflowTestsDirectory = path.resolve(__dirname, '..'); const workflowTestMocksDirectory = path.join(workflowTestsDirectory, 'mocks'); @@ -201,12 +199,12 @@ const parseWorkflowFile = (workflow: YamlWorkflow) => { workflowJobs[jobId] = { steps: [], }; - job.steps.forEach((step: Step) => { + job.steps.forEach((step) => { const workflowStep = { - name: step.name, + name: step.name ?? '', inputs: Object.keys(step.with ?? {}), envs: step.envs ?? [], - }; + } as StepIdentifier; workflowJobs[jobId].steps.push(workflowStep); }); }); @@ -219,7 +217,7 @@ const getMockFileContent = (workflowName: string, jobs: Record { - const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${(step.name as string) + const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${step.name .replaceAll(' ', '_') .replaceAll('-', '_') .replaceAll(',', '') @@ -245,7 +243,7 @@ const getAssertionsFileContent = (jobs: Record): string => Object.entries(jobs).forEach(([jobId, job]) => { let stepAssertionsContent = ''; - job.steps.forEach((step: Step) => { + job.steps.forEach((step: StepIdentifier) => { stepAssertionsContent += stepAssertionTemplate(step.name, jobId.toUpperCase(), step.name, step.inputs, step.envs); }); const jobAssertionName = `assert${jobId.charAt(0).toUpperCase() + jobId.slice(1)}JobExecuted`; diff --git a/workflow_tests/utils/utils.ts b/workflow_tests/utils/utils.ts index b70a88c24c7a..494f830fb744 100644 --- a/workflow_tests/utils/utils.ts +++ b/workflow_tests/utils/utils.ts @@ -1,5 +1,4 @@ -import type {EventJSON} from '@kie/act-js/build/src/action-event/action-event.types'; -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {EventJSON, StepIdentifier} from '@kie/act-js'; import fs from 'fs'; import path from 'path'; import yaml from 'yaml'; @@ -13,6 +12,18 @@ type StepAssertion = { output: string; }; +type Jobs = Record< + string, + { + // eslint-disable-next-line @typescript-eslint/naming-convention + 'runs-on': string; + } +>; + +type Workflow = { + jobs: Jobs; +}; + function setUpActParams( act: ExtendedAct, event: string | null = null, @@ -159,7 +170,7 @@ function setJobRunners(act: ExtendedAct, jobs: Record, workflowP return act; } - const workflow = yaml.parse(fs.readFileSync(workflowPath, 'utf8')); + const workflow: Workflow = yaml.parse(fs.readFileSync(workflowPath, 'utf8')); Object.entries(jobs).forEach(([jobId, runner]) => { const job = workflow.jobs[jobId]; job['runs-on'] = runner;