diff --git a/.eslintrc.js b/.eslintrc.js index 5c23c7be0839..54d035ab3850 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -171,6 +171,21 @@ module.exports = { '@typescript-eslint/switch-exhaustiveness-check': 'error', '@typescript-eslint/consistent-type-definitions': ['error', 'type'], '@typescript-eslint/no-floating-promises': 'off', + '@typescript-eslint/consistent-type-imports': [ + 'error', + { + prefer: 'type-imports', + fixStyle: 'separate-type-imports', + }, + ], + '@typescript-eslint/no-import-type-side-effects': 'error', + '@typescript-eslint/consistent-type-exports': [ + 'error', + { + fixMixedExportsWithInlineTypeSpecifier: false, + }, + ], + 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], 'es/no-nullish-coalescing-operators': 'off', 'es/no-optional-chaining': 'off', 'valid-jsdoc': 'off', diff --git a/.github/actions/javascript/authorChecklist/categories/index.ts b/.github/actions/javascript/authorChecklist/categories/index.ts index 53e0ed2ab838..5ed63c647e74 100644 --- a/.github/actions/javascript/authorChecklist/categories/index.ts +++ b/.github/actions/javascript/authorChecklist/categories/index.ts @@ -1,4 +1,4 @@ -import Category from './Category'; +import type Category from './Category'; import newComponent from './newComponentCategory'; const categories: Category[] = [newComponent]; diff --git a/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts b/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts index 63e26c015a5a..405a687b5d3e 100644 --- a/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts +++ b/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts @@ -4,7 +4,7 @@ import traverse from '@babel/traverse'; import CONST from '../../../../libs/CONST'; import GithubUtils from '../../../../libs/GithubUtils'; import promiseSome from '../../../../libs/promiseSome'; -import Category from './Category'; +import type Category from './Category'; type SuperClassType = {superClass: {name?: string; object: {name: string}; property: {name: string}} | null; name: string}; diff --git a/.github/actions/javascript/validateReassureOutput/action.yml b/.github/actions/javascript/validateReassureOutput/action.yml index 4fd53e838fb5..b3b18c244a8f 100644 --- a/.github/actions/javascript/validateReassureOutput/action.yml +++ b/.github/actions/javascript/validateReassureOutput/action.yml @@ -7,9 +7,6 @@ inputs: COUNT_DEVIATION: description: Allowable deviation for the mean count in regression test results. required: true - REGRESSION_OUTPUT: - description: Refers to the results obtained from regression tests `.reassure/output.json`. - required: true runs: using: 'node20' main: './index.js' diff --git a/.github/actions/javascript/validateReassureOutput/index.js b/.github/actions/javascript/validateReassureOutput/index.js index 6cc59af1de48..e70c379697cd 100644 --- a/.github/actions/javascript/validateReassureOutput/index.js +++ b/.github/actions/javascript/validateReassureOutput/index.js @@ -8,9 +8,10 @@ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const core = __nccwpck_require__(186); +const fs = __nccwpck_require__(147); const run = () => { - const regressionOutput = JSON.parse(core.getInput('REGRESSION_OUTPUT', {required: true})); + const regressionOutput = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8')); const countDeviation = core.getInput('COUNT_DEVIATION', {required: true}); const durationDeviation = core.getInput('DURATION_DEVIATION_PERCENTAGE', {required: true}); diff --git a/.github/actions/javascript/validateReassureOutput/validateReassureOutput.js b/.github/actions/javascript/validateReassureOutput/validateReassureOutput.js index da81d88c9885..214dc9e8b6d4 100644 --- a/.github/actions/javascript/validateReassureOutput/validateReassureOutput.js +++ b/.github/actions/javascript/validateReassureOutput/validateReassureOutput.js @@ -1,7 +1,8 @@ const core = require('@actions/core'); +const fs = require('fs'); const run = () => { - const regressionOutput = JSON.parse(core.getInput('REGRESSION_OUTPUT', {required: true})); + const regressionOutput = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8')); const countDeviation = core.getInput('COUNT_DEVIATION', {required: true}); const durationDeviation = core.getInput('DURATION_DEVIATION_PERCENTAGE', {required: true}); diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index 6aeecb3b4e05..813c341caaf6 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -10,7 +10,6 @@ on: env: SHOULD_DEPLOY_PRODUCTION: ${{ github.event_name == 'release' }} - DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer concurrency: group: ${{ github.workflow }}-${{ github.event_name }} @@ -174,6 +173,8 @@ jobs: name: Build and deploy iOS needs: validateActor if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} + env: + DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer runs-on: macos-13-xlarge steps: - name: Checkout diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index c49530c46faa..116f178868c1 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -36,17 +36,10 @@ jobs: npm install --force npx reassure --branch - - name: Read output.json - id: reassure - uses: juliangruber/read-file-action@v1 - with: - path: .reassure/output.json - - name: Validate output.json id: validateReassureOutput uses: ./.github/actions/javascript/validateReassureOutput with: DURATION_DEVIATION_PERCENTAGE: 20 COUNT_DEVIATION: 0 - REGRESSION_OUTPUT: ${{ steps.reassure.outputs.content }} diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 8b18b8aa5d53..25a14fb27e1b 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -10,9 +10,6 @@ on: types: [opened, synchronize, labeled] branches: ['*ci-test/**'] -env: - DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer - jobs: validateActor: runs-on: ubuntu-latest @@ -139,6 +136,7 @@ jobs: if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }} env: PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }} + DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer runs-on: macos-13-xlarge steps: - name: Checkout diff --git a/android/app/build.gradle b/android/app/build.gradle index e93150b48fca..7b96e1133366 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -96,8 +96,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001042101 - versionName "1.4.21-1" + versionCode 1001042105 + versionName "1.4.21-5" } flavorDimensions "default" diff --git a/assets/emojis/common.ts b/assets/emojis/common.ts index cbefb21cf2d6..b23383590c51 100644 --- a/assets/emojis/common.ts +++ b/assets/emojis/common.ts @@ -7,7 +7,7 @@ import TravelAndPlaces from '@assets/images/emojiCategoryIcons/plane.svg'; import AnimalsAndNature from '@assets/images/emojiCategoryIcons/plant.svg'; import Activities from '@assets/images/emojiCategoryIcons/soccer-ball.svg'; import FrequentlyUsed from '@assets/images/history.svg'; -import {HeaderEmoji, PickerEmojis} from './types'; +import type {HeaderEmoji, PickerEmojis} from './types'; const skinTones = [ { diff --git a/assets/emojis/en.ts b/assets/emojis/en.ts index 0a1ca7611117..28051e5ecd99 100644 --- a/assets/emojis/en.ts +++ b/assets/emojis/en.ts @@ -1,4 +1,4 @@ -import {EmojisList} from './types'; +import type {EmojisList} from './types'; /* eslint-disable @typescript-eslint/naming-convention */ const enEmojis: EmojisList = { diff --git a/assets/emojis/es.ts b/assets/emojis/es.ts index 46f825643859..0d23f887f556 100644 --- a/assets/emojis/es.ts +++ b/assets/emojis/es.ts @@ -1,4 +1,4 @@ -import {EmojisList} from './types'; +import type {EmojisList} from './types'; /* eslint-disable @typescript-eslint/naming-convention */ const esEmojis: EmojisList = { diff --git a/assets/emojis/index.ts b/assets/emojis/index.ts index bc62adc4b252..5e5565da1499 100644 --- a/assets/emojis/index.ts +++ b/assets/emojis/index.ts @@ -1,7 +1,7 @@ import emojis from './common'; import enEmojis from './en'; import esEmojis from './es'; -import {Emoji} from './types'; +import type {Emoji} from './types'; type EmojiTable = Record; diff --git a/assets/emojis/types.ts b/assets/emojis/types.ts index c3a3b692f202..e8c222fde948 100644 --- a/assets/emojis/types.ts +++ b/assets/emojis/types.ts @@ -1,4 +1,4 @@ -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; type Emoji = { code: string; diff --git a/contributingGuides/TS_STYLE.md b/contributingGuides/TS_STYLE.md index a583941bf71d..b60c28147a45 100644 --- a/contributingGuides/TS_STYLE.md +++ b/contributingGuides/TS_STYLE.md @@ -26,6 +26,7 @@ - [1.19 Satisfies operator](#satisfies-operator) - [1.20 Hooks instead of HOCs](#hooks-instead-of-hocs) - [1.21 `compose` usage](#compose-usage) + - [1.22 Type imports](#type-imports) - [Exception to Rules](#exception-to-rules) - [Communication Items](#communication-items) - [Migration Guidelines](#migration-guidelines) @@ -383,7 +384,7 @@ type Foo = { -- [1.15](#file-organization) **File organization**: In modules with platform-specific implementations, create `types.ts` to define shared types. Import and use shared types in each platform specific files. Do not use [`satisfies` operator](#satisfies-operator) for platform-specific implementations, always define shared types that complies with all variants. +- [1.15](#file-organization) **File organization**: In modules with platform-specific implementations, create `types.ts` to define shared types. Import and use shared types in each platform specific files. Do not use [`satisfies` operator](#satisfies-operator) for platform-specific implementations, always define shared types that complies with all variants. > Why? To encourage consistent API across platform-specific implementations. If you're migrating module that doesn't have a default implement (i.e. `index.ts`, e.g. `getPlatform`), refer to [Migration Guidelines](#migration-guidelines) for further information. @@ -514,7 +515,7 @@ type Foo = { - [1.20](#hooks-instead-of-hocs) **Hooks instead of HOCs**: Replace HOCs usage with Hooks whenever possible. - + > Why? Hooks are easier to use (can be used inside the function component), and don't need nesting or `compose` when exporting the component. It also allows us to remove `compose` completely in some components since it has been bringing up some issues with TypeScript. Read the [`compose` usage](#compose-usage) section for further information about the TypeScript issues with `compose`. > Note: Because Onyx doesn't provide a hook yet, in a component that accesses Onyx data with `withOnyx` HOC, please make sure that you don't use other HOCs (if applicable) to avoid HOC nesting. @@ -571,7 +572,7 @@ type Foo = { - [1.21](#compose-usage) **`compose` usage**: Avoid the usage of `compose` function to compose HOCs in TypeScript files. Use nesting instead. - + > Why? `compose` function doesn't work well with TypeScript when dealing with several HOCs being used in a component, many times resulting in wrong types and errors. Instead, nesting can be used to allow a seamless use of multiple HOCs and result in a correct return type of the compoment. Also, you can use [hooks instead of HOCs](#hooks-instead-of-hocs) whenever possible to minimize or even remove the need of HOCs in the component. ```ts @@ -607,6 +608,38 @@ type Foo = { export default withCurrentUserPersonalDetails(ComponentWithReportOrNotFound); ``` + + +- [1.22](#type-imports) **Type imports/exports**: Always use the `type` keyword when importing/exporting types + + > Why? In order to improve code clarity and consistency and reduce bundle size after typescript transpilation, we enforce the all type imports/exports to contain the `type` keyword. This way, TypeScript can automatically remove those imports from the transpiled JavaScript bundle + + Imports: + ```ts + // BAD + import {SomeType} from './a' + import someVariable from './a' + + import {someVariable, SomeOtherType} from './b' + + // GOOD + import type {SomeType} from './a' + import someVariable from './a' + ``` + + Exports: + ```ts + // BAD + export {SomeType} + export someVariable + // or + export {someVariable, SomeOtherType} + + // GOOD + export type {SomeType} + export someVariable + ``` + ## Exception to Rules Most of the rules are enforced in ESLint or checked by TypeScript. If you think your particular situation warrants an exception, post the context in the `#expensify-open-source` Slack channel with your message prefixed with `TS EXCEPTION:`. The internal engineer assigned to the PR should be the one that approves each exception, however all discussion regarding granting exceptions should happen in the public channel instead of the GitHub PR page so that the TS migration team can access them easily. diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index f267261a49c0..a8da53ed57a7 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -40,7 +40,7 @@ CFBundleVersion - 1.4.21.1 + 1.4.21.5 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index f95a3f871d4c..20c2d8e334bf 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.4.21.1 + 1.4.21.5 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 77c390c46416..ee54d98895a5 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -614,7 +614,7 @@ PODS: - React-Core - react-native-pager-view (6.2.0): - React-Core - - react-native-pdf (6.7.3): + - react-native-pdf (6.7.4): - React-Core - react-native-performance (5.1.0): - React-Core @@ -1265,7 +1265,7 @@ SPEC CHECKSUMS: react-native-key-command: 5af6ee30ff4932f78da6a2109017549042932aa5 react-native-netinfo: ccbe1085dffd16592791d550189772e13bf479e2 react-native-pager-view: 0ccb8bf60e2ebd38b1f3669fa3650ecce81db2df - react-native-pdf: b4ca3d37a9a86d9165287741c8b2ef4d8940c00e + react-native-pdf: 79aa75e39a80c1d45ffe58aa500f3cf08f267a2e react-native-performance: cef2b618d47b277fb5c3280b81a3aad1e72f2886 react-native-plaid-link-sdk: df1618a85a615d62ff34e34b76abb7a56497fbc1 react-native-quick-sqlite: bcc7a7a250a40222f18913a97cd356bf82d0a6c4 diff --git a/package-lock.json b/package-lock.json index 74abd69ab118..ac88e9262f53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.4.21-1", + "version": "1.4.21-5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.4.21-1", + "version": "1.4.21-5", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -96,7 +96,7 @@ "react-native-modal": "^13.0.0", "react-native-onyx": "1.0.118", "react-native-pager-view": "^6.2.0", - "react-native-pdf": "^6.7.3", + "react-native-pdf": "^6.7.4", "react-native-performance": "^5.1.0", "react-native-permissions": "^3.9.3", "react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#7a407cd4174d9838a944c1c2e1cb4a9737ac69c5", @@ -201,6 +201,7 @@ "eslint-config-airbnb-typescript": "^17.1.0", "eslint-config-expensify": "^2.0.43", "eslint-config-prettier": "^8.8.0", + "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", "eslint-plugin-jsdoc": "^46.2.6", "eslint-plugin-jsx-a11y": "^6.6.1", @@ -21202,8 +21203,7 @@ "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/keyv": { "version": "3.1.4", @@ -23403,15 +23403,15 @@ "license": "MIT" }, "node_modules/array-includes": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", - "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", + "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", - "get-intrinsic": "^1.1.3", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", "is-string": "^1.0.7" }, "engines": { @@ -23448,15 +23448,34 @@ "node": ">=0.10.0" } }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array.prototype.flat": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", - "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0" }, "engines": { @@ -23467,14 +23486,14 @@ } }, "node_modules/array.prototype.flatmap": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz", - "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0" }, "engines": { @@ -30582,12 +30601,14 @@ } }, "node_modules/eslint-import-resolver-node": { - "version": "0.3.6", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", "dev": true, - "license": "MIT", "dependencies": { "debug": "^3.2.7", - "resolve": "^1.20.0" + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" } }, "node_modules/eslint-import-resolver-node/node_modules/debug": { @@ -30595,15 +30616,15 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, - "license": "MIT", "dependencies": { "ms": "^2.1.1" } }, "node_modules/eslint-module-utils": { - "version": "2.7.4", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", "dev": true, - "license": "MIT", "dependencies": { "debug": "^3.2.7" }, @@ -30621,7 +30642,6 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, - "license": "MIT", "dependencies": { "ms": "^2.1.1" } @@ -30719,23 +30739,28 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.26.0", + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", "dev": true, - "license": "MIT", "dependencies": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.3", - "has": "^1.0.3", - "is-core-module": "^2.8.1", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", "is-glob": "^4.0.3", "minimatch": "^3.1.2", - "object.values": "^1.1.5", - "resolve": "^1.22.0", - "tsconfig-paths": "^3.14.1" + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.15.0" }, "engines": { "node": ">=4" @@ -30745,11 +30770,12 @@ } }, "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "2.6.9", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, - "license": "MIT", "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "node_modules/eslint-plugin-import/node_modules/doctrine": { @@ -30765,12 +30791,14 @@ "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-import/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, - "license": "MIT" + "bin": { + "semver": "bin/semver.js" + } }, "node_modules/eslint-plugin-jest": { "version": "24.7.0", @@ -33493,10 +33521,12 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "license": "MIT" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/function.prototype.name": { "version": "1.1.5", @@ -34214,6 +34244,17 @@ "minimalistic-assert": "^1.0.1" } }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/hast-to-hyperscript": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz", @@ -35900,11 +35941,11 @@ } }, "node_modules/is-core-module": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", - "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -44759,14 +44800,14 @@ } }, "node_modules/object.fromentries": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.6.tgz", - "integrity": "sha512-VciD13dswC4j1Xt5394WR4MzmAQmlgN72phd/riNp9vtD7tp4QQWJ0R4wvclXcafgcYK8veHRed2W6XeGBvcfg==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", + "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" @@ -44792,6 +44833,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, "node_modules/object.hasown": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.2.tgz", @@ -44819,14 +44872,14 @@ } }, "node_modules/object.values": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", - "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", + "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" @@ -47582,9 +47635,9 @@ } }, "node_modules/react-native-pdf": { - "version": "6.7.3", - "resolved": "https://registry.npmjs.org/react-native-pdf/-/react-native-pdf-6.7.3.tgz", - "integrity": "sha512-bK1fVkj18kBA5YlRFNJ3/vJ1bEX3FDHyAPY6ArtIdVs+vv0HzcK5WH9LSd2bxUsEMIyY9CSjP4j8BcxNXTiQkQ==", + "version": "6.7.4", + "resolved": "https://registry.npmjs.org/react-native-pdf/-/react-native-pdf-6.7.4.tgz", + "integrity": "sha512-sBeNcsrTRnLjmiU9Wx7Uk0K2kPSQtKIIG+FECdrEG16TOdtmQ3iqqEwt0dmy0pJegpg07uES5BXqiKsKkRUIFw==", "dependencies": { "crypto-js": "4.2.0", "deprecated-react-native-prop-types": "^2.3.0" @@ -53277,12 +53330,13 @@ "license": "Apache-2.0" }, "node_modules/tsconfig-paths": { - "version": "3.14.1", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", "dev": true, - "license": "MIT", "dependencies": { "@types/json5": "^0.0.29", - "json5": "^1.0.1", + "json5": "^1.0.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" } @@ -53304,7 +53358,6 @@ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -73074,15 +73127,15 @@ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, "array-includes": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", - "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", + "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", - "get-intrinsic": "^1.1.3", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", "is-string": "^1.0.7" } }, @@ -73101,27 +73154,40 @@ "integrity": "sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ==", "devOptional": true }, + "array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + } + }, "array.prototype.flat": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", - "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0" } }, "array.prototype.flatmap": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz", - "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0" } }, @@ -78429,11 +78495,14 @@ "requires": {} }, "eslint-import-resolver-node": { - "version": "0.3.6", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", "dev": true, "requires": { "debug": "^3.2.7", - "resolve": "^1.20.0" + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" }, "dependencies": { "debug": { @@ -78448,7 +78517,9 @@ } }, "eslint-module-utils": { - "version": "2.7.4", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", "dev": true, "requires": { "debug": "^3.2.7" @@ -78520,29 +78591,37 @@ } }, "eslint-plugin-import": { - "version": "2.26.0", + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", "dev": true, "requires": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.3", - "has": "^1.0.3", - "is-core-module": "^2.8.1", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", "is-glob": "^4.0.3", "minimatch": "^3.1.2", - "object.values": "^1.1.5", - "resolve": "^1.22.0", - "tsconfig-paths": "^3.14.1" + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.15.0" }, "dependencies": { "debug": { - "version": "2.6.9", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "doctrine": { @@ -78554,10 +78633,10 @@ "esutils": "^2.0.2" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true } } @@ -80424,9 +80503,9 @@ "optional": true }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==" }, "function.prototype.name": { "version": "1.1.5", @@ -80914,6 +80993,14 @@ "minimalistic-assert": "^1.0.1" } }, + "hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "requires": { + "function-bind": "^1.1.2" + } + }, "hast-to-hyperscript": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz", @@ -82096,11 +82183,11 @@ } }, "is-core-module": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", - "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "requires": { - "has": "^1.0.3" + "hasown": "^2.0.0" } }, "is-data-descriptor": { @@ -88377,14 +88464,14 @@ } }, "object.fromentries": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.6.tgz", - "integrity": "sha512-VciD13dswC4j1Xt5394WR4MzmAQmlgN72phd/riNp9vtD7tp4QQWJ0R4wvclXcafgcYK8veHRed2W6XeGBvcfg==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", + "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" } }, "object.getownpropertydescriptors": { @@ -88397,6 +88484,18 @@ "es-abstract": "^1.20.1" } }, + "object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, "object.hasown": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.2.tgz", @@ -88417,14 +88516,14 @@ } }, "object.values": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", - "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", + "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" } }, "objectorarray": { @@ -90432,9 +90531,9 @@ "requires": {} }, "react-native-pdf": { - "version": "6.7.3", - "resolved": "https://registry.npmjs.org/react-native-pdf/-/react-native-pdf-6.7.3.tgz", - "integrity": "sha512-bK1fVkj18kBA5YlRFNJ3/vJ1bEX3FDHyAPY6ArtIdVs+vv0HzcK5WH9LSd2bxUsEMIyY9CSjP4j8BcxNXTiQkQ==", + "version": "6.7.4", + "resolved": "https://registry.npmjs.org/react-native-pdf/-/react-native-pdf-6.7.4.tgz", + "integrity": "sha512-sBeNcsrTRnLjmiU9Wx7Uk0K2kPSQtKIIG+FECdrEG16TOdtmQ3iqqEwt0dmy0pJegpg07uES5BXqiKsKkRUIFw==", "requires": { "crypto-js": "4.2.0", "deprecated-react-native-prop-types": "^2.3.0" @@ -94475,11 +94574,13 @@ "integrity": "sha512-FZIXf1ksVyLcfr7M317jbB67XFJhOO1YqdTcuGaq9q5jLUoTikukZ+98TPjKiP2jC5CgmYdWWYs0s2nLSU0/1A==" }, "tsconfig-paths": { - "version": "3.14.1", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", "dev": true, "requires": { "@types/json5": "^0.0.29", - "json5": "^1.0.1", + "json5": "^1.0.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" }, diff --git a/package.json b/package.json index be84402b8683..550e7ca12dd6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.4.21-1", + "version": "1.4.21-5", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", @@ -144,7 +144,7 @@ "react-native-modal": "^13.0.0", "react-native-onyx": "1.0.118", "react-native-pager-view": "^6.2.0", - "react-native-pdf": "^6.7.3", + "react-native-pdf": "^6.7.4", "react-native-performance": "^5.1.0", "react-native-permissions": "^3.9.3", "react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#7a407cd4174d9838a944c1c2e1cb4a9737ac69c5", @@ -249,6 +249,7 @@ "eslint-config-airbnb-typescript": "^17.1.0", "eslint-config-expensify": "^2.0.43", "eslint-config-prettier": "^8.8.0", + "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", "eslint-plugin-jsdoc": "^46.2.6", "eslint-plugin-jsx-a11y": "^6.6.1", diff --git a/src/CONFIG.ts b/src/CONFIG.ts index 61e347671269..37da65f0c305 100644 --- a/src/CONFIG.ts +++ b/src/CONFIG.ts @@ -1,5 +1,6 @@ import {Platform} from 'react-native'; -import Config, {NativeConfig} from 'react-native-config'; +import type {NativeConfig} from 'react-native-config'; +import Config from 'react-native-config'; import CONST from './CONST'; import getPlatform from './libs/getPlatform'; import * as Url from './libs/Url'; diff --git a/src/CONST.ts b/src/CONST.ts index 0c98645511d4..2e2719a1e48f 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1177,7 +1177,6 @@ const CONST = { EXPENSIFY: 'Expensify', VBBA: 'ACH', }, - DEFAULT_AMOUNT: 0, TYPE: { SEND: 'send', SPLIT: 'split', @@ -3055,6 +3054,42 @@ const CONST = { CAROUSEL: 3, }, + VIOLATIONS: { + ALL_TAG_LEVELS_REQUIRED: 'allTagLevelsRequired', + AUTO_REPORTED_REJECTED_EXPENSE: 'autoReportedRejectedExpense', + BILLABLE_EXPENSE: 'billableExpense', + CASH_EXPENSE_WITH_NO_RECEIPT: 'cashExpenseWithNoReceipt', + CATEGORY_OUT_OF_POLICY: 'categoryOutOfPolicy', + CONVERSION_SURCHARGE: 'conversionSurcharge', + CUSTOM_UNIT_OUT_OF_POLICY: 'customUnitOutOfPolicy', + DUPLICATED_TRANSACTION: 'duplicatedTransaction', + FIELD_REQUIRED: 'fieldRequired', + FUTURE_DATE: 'futureDate', + INVOICE_MARKUP: 'invoiceMarkup', + MAX_AGE: 'maxAge', + MISSING_CATEGORY: 'missingCategory', + MISSING_COMMENT: 'missingComment', + MISSING_TAG: 'missingTag', + MODIFIED_AMOUNT: 'modifiedAmount', + MODIFIED_DATE: 'modifiedDate', + NON_EXPENSIWORKS_EXPENSE: 'nonExpensiworksExpense', + OVER_AUTO_APPROVAL_LIMIT: 'overAutoApprovalLimit', + OVER_CATEGORY_LIMIT: 'overCategoryLimit', + OVER_LIMIT: 'overLimit', + OVER_LIMIT_ATTENDEE: 'overLimitAttendee', + PER_DAY_LIMIT: 'perDayLimit', + RECEIPT_NOT_SMART_SCANNED: 'receiptNotSmartScanned', + RECEIPT_REQUIRED: 'receiptRequired', + RTER: 'rter', + SMARTSCAN_FAILED: 'smartscanFailed', + SOME_TAG_LEVELS_REQUIRED: 'someTagLevelsRequired', + TAG_OUT_OF_POLICY: 'tagOutOfPolicy', + TAX_AMOUNT_CHANGED: 'taxAmountChanged', + TAX_OUT_OF_POLICY: 'taxOutOfPolicy', + TAX_RATE_CHANGED: 'taxRateChanged', + TAX_REQUIRED: 'taxRequired', + }, + /** Context menu types */ CONTEXT_MENU_TYPES: { LINK: 'LINK', diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index dff3a0aa441b..89ddbdc06883 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -1,8 +1,8 @@ -import {OnyxEntry} from 'react-native-onyx/lib/types'; -import {ValueOf} from 'type-fest'; -import CONST from './CONST'; -import * as OnyxTypes from './types/onyx'; -import DeepValueOf from './types/utils/DeepValueOf'; +import type {OnyxEntry} from 'react-native-onyx/lib/types'; +import type {ValueOf} from 'type-fest'; +import type CONST from './CONST'; +import type * as OnyxTypes from './types/onyx'; +import type DeepValueOf from './types/utils/DeepValueOf'; /** * This is a file containing constants for all the top level keys in our store diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 49067d1c7b8f..35fa4bbf0837 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1,5 +1,5 @@ -import {IsEqual, ValueOf} from 'type-fest'; -import CONST from './CONST'; +import type {IsEqual, ValueOf} from 'type-fest'; +import type CONST from './CONST'; // This is a file containing constants for all the routes we want to be able to go to diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 26a23e7efadc..91c4153bacd2 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -2,7 +2,7 @@ * This is a file containing constants for all of the screen names. In most cases, we should use the routes for * navigation. But there are situations where we may need to access screen names directly. */ -import DeepValueOf from './types/utils/DeepValueOf'; +import type DeepValueOf from './types/utils/DeepValueOf'; const PROTECTED_SCREENS = { HOME: 'Home', diff --git a/src/components/AddressSearch/index.js b/src/components/AddressSearch/index.js index 31b04a3d954f..9f2635633318 100644 --- a/src/components/AddressSearch/index.js +++ b/src/components/AddressSearch/index.js @@ -349,6 +349,7 @@ function AddressSearch({ lat: successData.coords.latitude, lng: successData.coords.longitude, address: CONST.YOUR_LOCATION_TEXT, + name: CONST.YOUR_LOCATION_TEXT, }; onPress(location); }, diff --git a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.tsx b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.tsx index 1bcdbb383f7a..bb3792f59d9f 100644 --- a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.tsx +++ b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly.tsx @@ -1,6 +1,7 @@ import Str from 'expensify-common/lib/str'; import React, {useEffect, useRef} from 'react'; -import {Text as RNText, StyleSheet} from 'react-native'; +import type {Text as RNText} from 'react-native'; +import {StyleSheet} from 'react-native'; import PressableWithSecondaryInteraction from '@components/PressableWithSecondaryInteraction'; import Text from '@components/Text'; import Tooltip from '@components/Tooltip'; diff --git a/src/components/AnchorForCommentsOnly/types.ts b/src/components/AnchorForCommentsOnly/types.ts index 005364c2077f..eea8571f5277 100644 --- a/src/components/AnchorForCommentsOnly/types.ts +++ b/src/components/AnchorForCommentsOnly/types.ts @@ -1,5 +1,5 @@ -import {StyleProp, TextStyle} from 'react-native'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {StyleProp, TextStyle} from 'react-native'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type AnchorForCommentsOnlyProps = ChildrenProps & { /** The URL to open */ diff --git a/src/components/AnimatedStep/AnimatedStepContext.ts b/src/components/AnimatedStep/AnimatedStepContext.ts index 3b4c5f79a34f..14dba4b27cc2 100644 --- a/src/components/AnimatedStep/AnimatedStepContext.ts +++ b/src/components/AnimatedStep/AnimatedStepContext.ts @@ -1,6 +1,7 @@ -import React, {createContext} from 'react'; -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type React from 'react'; +import {createContext} from 'react'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; type AnimationDirection = ValueOf; diff --git a/src/components/AnimatedStep/AnimatedStepProvider.tsx b/src/components/AnimatedStep/AnimatedStepProvider.tsx index 53b3a0e0a53d..ea268e1d52cb 100644 --- a/src/components/AnimatedStep/AnimatedStepProvider.tsx +++ b/src/components/AnimatedStep/AnimatedStepProvider.tsx @@ -1,7 +1,8 @@ import React, {useMemo, useState} from 'react'; import CONST from '@src/CONST'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; -import AnimatedStepContext, {AnimationDirection} from './AnimatedStepContext'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {AnimationDirection} from './AnimatedStepContext'; +import AnimatedStepContext from './AnimatedStepContext'; function AnimatedStepProvider({children}: ChildrenProps): React.ReactNode { const [animationDirection, setAnimationDirection] = useState(CONST.ANIMATION_DIRECTION.IN); diff --git a/src/components/AnimatedStep/index.tsx b/src/components/AnimatedStep/index.tsx index e2b9952c0617..66d2108ca5d8 100644 --- a/src/components/AnimatedStep/index.tsx +++ b/src/components/AnimatedStep/index.tsx @@ -1,11 +1,11 @@ import React, {useMemo} from 'react'; -import {StyleProp, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; import * as Animatable from 'react-native-animatable'; import useThemeStyles from '@hooks/useThemeStyles'; import useNativeDriver from '@libs/useNativeDriver'; import CONST from '@src/CONST'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; -import {AnimationDirection} from './AnimatedStepContext'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {AnimationDirection} from './AnimatedStepContext'; type AnimatedStepProps = ChildrenProps & { /** Styles to be assigned to Container */ diff --git a/src/components/AnimatedStep/useAnimatedStepContext.ts b/src/components/AnimatedStep/useAnimatedStepContext.ts index 3edc71e5289e..2adde8fd576e 100644 --- a/src/components/AnimatedStep/useAnimatedStepContext.ts +++ b/src/components/AnimatedStep/useAnimatedStepContext.ts @@ -1,5 +1,6 @@ import {useContext} from 'react'; -import AnimatedStepContext, {StepContext} from './AnimatedStepContext'; +import type {StepContext} from './AnimatedStepContext'; +import AnimatedStepContext from './AnimatedStepContext'; function useAnimatedStepContext(): StepContext { const context = useContext(AnimatedStepContext); diff --git a/src/components/AnonymousReportFooter.tsx b/src/components/AnonymousReportFooter.tsx index 877ca9444661..ad79e316baf3 100644 --- a/src/components/AnonymousReportFooter.tsx +++ b/src/components/AnonymousReportFooter.tsx @@ -1,11 +1,11 @@ import React from 'react'; import {Text, View} from 'react-native'; -import {OnyxCollection} from 'react-native-onyx'; -import {OnyxEntry} from 'react-native-onyx/lib/types'; +import type {OnyxCollection} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx/lib/types'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Session from '@userActions/Session'; -import {PersonalDetails, Report} from '@src/types/onyx'; +import type {PersonalDetails, Report} from '@src/types/onyx'; import AvatarWithDisplayName from './AvatarWithDisplayName'; import Button from './Button'; import ExpensifyWordmark from './ExpensifyWordmark'; diff --git a/src/components/ArchivedReportFooter.tsx b/src/components/ArchivedReportFooter.tsx index 2dae84106971..083c8340baa6 100644 --- a/src/components/ArchivedReportFooter.tsx +++ b/src/components/ArchivedReportFooter.tsx @@ -1,6 +1,7 @@ import lodashEscape from 'lodash/escape'; import React from 'react'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; diff --git a/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.tsx b/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.tsx index b72662f989dc..fc3bf4659bd7 100644 --- a/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.tsx +++ b/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.tsx @@ -1,6 +1,7 @@ import {FlashList} from '@shopify/flash-list'; -import React, {ForwardedRef, forwardRef, ReactElement, useCallback, useEffect, useMemo, useRef} from 'react'; -import {View} from 'react-native'; +import type {ForwardedRef, ReactElement} from 'react'; +import React, {forwardRef, useCallback, useEffect, useMemo, useRef} from 'react'; +import type {View} from 'react-native'; // We take ScrollView from this package to properly handle the scrolling of AutoCompleteSuggestions in chats since one scroll is nested inside another import {ScrollView} from 'react-native-gesture-handler'; import Animated, {Easing, FadeOutDown, useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated'; diff --git a/src/components/AutoCompleteSuggestions/types.ts b/src/components/AutoCompleteSuggestions/types.ts index 9130f5139d71..61d614dcf2e4 100644 --- a/src/components/AutoCompleteSuggestions/types.ts +++ b/src/components/AutoCompleteSuggestions/types.ts @@ -1,4 +1,4 @@ -import {ReactElement} from 'react'; +import type {ReactElement} from 'react'; type MeasureParentContainerCallback = (x: number, y: number, width: number) => void; diff --git a/src/components/AutoUpdateTime.tsx b/src/components/AutoUpdateTime.tsx index 258bdb281eb2..f6be32fd3970 100644 --- a/src/components/AutoUpdateTime.tsx +++ b/src/components/AutoUpdateTime.tsx @@ -6,9 +6,10 @@ import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import DateUtils from '@libs/DateUtils'; -import {Timezone} from '@src/types/onyx/PersonalDetails'; +import type {Timezone} from '@src/types/onyx/PersonalDetails'; import Text from './Text'; -import withLocalize, {WithLocalizeProps} from './withLocalize'; +import type {WithLocalizeProps} from './withLocalize'; +import withLocalize from './withLocalize'; type AutoUpdateTimeProps = WithLocalizeProps & { /** Timezone of the user from their personal details */ diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx index 65b0b6c36061..4da91c2e7d19 100644 --- a/src/components/Avatar.tsx +++ b/src/components/Avatar.tsx @@ -1,14 +1,15 @@ import React, {useEffect, useState} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useNetwork from '@hooks/useNetwork'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportUtils from '@libs/ReportUtils'; -import {AvatarSource} from '@libs/UserUtils'; +import type {AvatarSource} from '@libs/UserUtils'; import type {AvatarSizeName} from '@styles/utils'; import CONST from '@src/CONST'; -import {AvatarType} from '@src/types/onyx/OnyxCommon'; +import type {AvatarType} from '@src/types/onyx/OnyxCommon'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import Image from './Image'; diff --git a/src/components/AvatarWithDisplayName.tsx b/src/components/AvatarWithDisplayName.tsx index b9bae33d7e23..4580f3b7e4d4 100644 --- a/src/components/AvatarWithDisplayName.tsx +++ b/src/components/AvatarWithDisplayName.tsx @@ -1,7 +1,8 @@ import React, {useCallback, useEffect, useRef} from 'react'; import {View} from 'react-native'; -import {OnyxCollection, OnyxEntry, withOnyx} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -11,7 +12,7 @@ import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import {PersonalDetails, Policy, Report, ReportActions} from '@src/types/onyx'; +import type {PersonalDetails, Policy, Report, ReportActions} from '@src/types/onyx'; import DisplayNames from './DisplayNames'; import MultipleAvatars from './MultipleAvatars'; import ParentNavigationSubtitle from './ParentNavigationSubtitle'; diff --git a/src/components/AvatarWithImagePicker.js b/src/components/AvatarWithImagePicker.js index d766d4cb6f22..71193147c292 100644 --- a/src/components/AvatarWithImagePicker.js +++ b/src/components/AvatarWithImagePicker.js @@ -322,7 +322,7 @@ function AvatarWithImagePicker({ src={Expensicons.Camera} width={variables.iconSizeSmall} height={variables.iconSizeSmall} - fill={theme.textLight} + fill={theme.icon} /> diff --git a/src/components/Badge.tsx b/src/components/Badge.tsx index 70aebc30ee83..5be33e6ff2ec 100644 --- a/src/components/Badge.tsx +++ b/src/components/Badge.tsx @@ -1,5 +1,6 @@ import React, {useCallback} from 'react'; -import {GestureResponderEvent, PressableStateCallbackType, StyleProp, TextStyle, View, ViewStyle} from 'react-native'; +import type {GestureResponderEvent, PressableStateCallbackType, StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; diff --git a/src/components/Banner.tsx b/src/components/Banner.tsx index d57257efab49..56fe7c4d0b42 100644 --- a/src/components/Banner.tsx +++ b/src/components/Banner.tsx @@ -1,5 +1,6 @@ import React, {memo} from 'react'; -import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'; +import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; diff --git a/src/components/BaseMiniContextMenuItem.tsx b/src/components/BaseMiniContextMenuItem.tsx index 8d115a37cba7..1f9a14cdfdee 100644 --- a/src/components/BaseMiniContextMenuItem.tsx +++ b/src/components/BaseMiniContextMenuItem.tsx @@ -1,5 +1,7 @@ -import React, {ForwardedRef} from 'react'; -import {PressableStateCallbackType, View} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React from 'react'; +import type {PressableStateCallbackType} from 'react-native'; +import {View} from 'react-native'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import DomUtils from '@libs/DomUtils'; diff --git a/src/components/BlockingViews/BlockingView.tsx b/src/components/BlockingViews/BlockingView.tsx index 3a038c58d886..edec30604b88 100644 --- a/src/components/BlockingViews/BlockingView.tsx +++ b/src/components/BlockingViews/BlockingView.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import {ImageSourcePropType, View} from 'react-native'; -import {SvgProps} from 'react-native-svg'; +import type {ImageSourcePropType} from 'react-native'; +import {View} from 'react-native'; +import type {SvgProps} from 'react-native-svg'; import AutoEmailLink from '@components/AutoEmailLink'; import Icon from '@components/Icon'; import Text from '@components/Text'; @@ -9,7 +10,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import variables from '@styles/variables'; -import {TranslationPaths} from '@src/languages/types'; +import type {TranslationPaths} from '@src/languages/types'; type BlockingViewProps = { /** Expensicon for the page */ diff --git a/src/components/BlockingViews/FullPageNotFoundView.tsx b/src/components/BlockingViews/FullPageNotFoundView.tsx index 6d7f838bf6c2..5993e60861f5 100644 --- a/src/components/BlockingViews/FullPageNotFoundView.tsx +++ b/src/components/BlockingViews/FullPageNotFoundView.tsx @@ -6,7 +6,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import variables from '@styles/variables'; -import {TranslationPaths} from '@src/languages/types'; +import type {TranslationPaths} from '@src/languages/types'; import ROUTES from '@src/ROUTES'; import BlockingView from './BlockingView'; diff --git a/src/components/BlockingViews/FullPageOfflineBlockingView.tsx b/src/components/BlockingViews/FullPageOfflineBlockingView.tsx index a9ebcf969ae5..787752dd4e72 100644 --- a/src/components/BlockingViews/FullPageOfflineBlockingView.tsx +++ b/src/components/BlockingViews/FullPageOfflineBlockingView.tsx @@ -3,7 +3,7 @@ import * as Expensicons from '@components/Icon/Expensicons'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useTheme from '@hooks/useTheme'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; import BlockingView from './BlockingView'; function FullPageOfflineBlockingView({children}: ChildrenProps) { diff --git a/src/components/Breadcrumbs.tsx b/src/components/Breadcrumbs.tsx index fa761218b4a0..6af3a4c6d477 100644 --- a/src/components/Breadcrumbs.tsx +++ b/src/components/Breadcrumbs.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import LogoComponent from '@assets/images/expensify-wordmark.svg'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index c6f6cd619c09..dd0499d4d243 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -1,6 +1,8 @@ import {useIsFocused} from '@react-navigation/native'; -import React, {ForwardedRef, useCallback} from 'react'; -import {ActivityIndicator, GestureResponderEvent, StyleProp, TextStyle, View, ViewStyle} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {useCallback} from 'react'; +import type {GestureResponderEvent, StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {ActivityIndicator, View} from 'react-native'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; @@ -12,8 +14,8 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import HapticFeedback from '@libs/HapticFeedback'; import CONST from '@src/CONST'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; -import IconAsset from '@src/types/utils/IconAsset'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import type IconAsset from '@src/types/utils/IconAsset'; import validateSubmitShortcut from './validateSubmitShortcut'; type ButtonWithText = { diff --git a/src/components/Button/validateSubmitShortcut/index.native.ts b/src/components/Button/validateSubmitShortcut/index.native.ts index 7687855f109b..3f277ed208a1 100644 --- a/src/components/Button/validateSubmitShortcut/index.native.ts +++ b/src/components/Button/validateSubmitShortcut/index.native.ts @@ -1,4 +1,4 @@ -import ValidateSubmitShortcut from './types'; +import type ValidateSubmitShortcut from './types'; /** * Validate if the submit shortcut should be triggered depending on the button state diff --git a/src/components/Button/validateSubmitShortcut/index.ts b/src/components/Button/validateSubmitShortcut/index.ts index 55b3e44192e4..695c56af7bb7 100644 --- a/src/components/Button/validateSubmitShortcut/index.ts +++ b/src/components/Button/validateSubmitShortcut/index.ts @@ -1,4 +1,4 @@ -import ValidateSubmitShortcut from './types'; +import type ValidateSubmitShortcut from './types'; /** * Validate if the submit shortcut should be triggered depending on the button state diff --git a/src/components/Button/validateSubmitShortcut/types.ts b/src/components/Button/validateSubmitShortcut/types.ts index 9970e1478a4c..088718d0334e 100644 --- a/src/components/Button/validateSubmitShortcut/types.ts +++ b/src/components/Button/validateSubmitShortcut/types.ts @@ -1,4 +1,4 @@ -import {GestureResponderEvent} from 'react-native'; +import type {GestureResponderEvent} from 'react-native'; type ValidateSubmitShortcut = (isFocused: boolean, isDisabled: boolean, isLoading: boolean, event?: GestureResponderEvent | KeyboardEvent) => boolean; diff --git a/src/components/CardPreview.tsx b/src/components/CardPreview.tsx index 2196e6f441bb..3ac56d6b26a8 100644 --- a/src/components/CardPreview.tsx +++ b/src/components/CardPreview.tsx @@ -1,12 +1,13 @@ import React from 'react'; import {View} from 'react-native'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import ExpensifyCardImage from '@assets/images/expensify-card.svg'; import usePrivatePersonalDetails from '@hooks/usePrivatePersonalDetails'; import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; import ONYXKEYS from '@src/ONYXKEYS'; -import {PrivatePersonalDetails, Session} from '@src/types/onyx'; +import type {PrivatePersonalDetails, Session} from '@src/types/onyx'; import ImageSVG from './ImageSVG'; import Text from './Text'; diff --git a/src/components/Checkbox.tsx b/src/components/Checkbox.tsx index ac18b550501d..7e7720b57a6e 100644 --- a/src/components/Checkbox.tsx +++ b/src/components/Checkbox.tsx @@ -1,10 +1,12 @@ -import React, {type ForwardedRef, forwardRef, type MouseEventHandler, type KeyboardEvent as ReactKeyboardEvent} from 'react'; -import {GestureResponderEvent, StyleProp, View, ViewStyle} from 'react-native'; +import React, {forwardRef} from 'react'; +import type {ForwardedRef, MouseEventHandler, KeyboardEvent as ReactKeyboardEvent} from 'react'; +import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import PressableWithFeedback from './Pressable/PressableWithFeedback'; diff --git a/src/components/CheckboxWithLabel.tsx b/src/components/CheckboxWithLabel.tsx index 9660c9e1a2e5..a25ccf184f52 100644 --- a/src/components/CheckboxWithLabel.tsx +++ b/src/components/CheckboxWithLabel.tsx @@ -1,5 +1,7 @@ -import React, {ComponentType, ForwardedRef, useState} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {ComponentType, ForwardedRef} from 'react'; +import React, {useState} from 'react'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; import Checkbox from './Checkbox'; diff --git a/src/components/CollapsibleSection/Collapsible/index.native.tsx b/src/components/CollapsibleSection/Collapsible/index.native.tsx index e8d3dc9439d0..63cb427f845f 100644 --- a/src/components/CollapsibleSection/Collapsible/index.native.tsx +++ b/src/components/CollapsibleSection/Collapsible/index.native.tsx @@ -1,6 +1,6 @@ import React from 'react'; import CollapsibleRN from 'react-native-collapsible'; -import CollapsibleProps from './types'; +import type CollapsibleProps from './types'; function Collapsible({isOpened = false, children}: CollapsibleProps) { return {children}; diff --git a/src/components/CollapsibleSection/Collapsible/index.tsx b/src/components/CollapsibleSection/Collapsible/index.tsx index 2585fd92f42b..5bf31c10ee68 100644 --- a/src/components/CollapsibleSection/Collapsible/index.tsx +++ b/src/components/CollapsibleSection/Collapsible/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import {Collapse} from 'react-collapse'; -import CollapsibleProps from './types'; +import type CollapsibleProps from './types'; function Collapsible({isOpened = false, children}: CollapsibleProps) { return {children}; diff --git a/src/components/CollapsibleSection/Collapsible/types.ts b/src/components/CollapsibleSection/Collapsible/types.ts index 8b8e8aba6860..a60b8d79f935 100644 --- a/src/components/CollapsibleSection/Collapsible/types.ts +++ b/src/components/CollapsibleSection/Collapsible/types.ts @@ -1,4 +1,4 @@ -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type CollapsibleProps = ChildrenProps & { /** Whether the section should start expanded. False by default */ diff --git a/src/components/CollapsibleSection/index.tsx b/src/components/CollapsibleSection/index.tsx index 18b24269b773..393a48e85616 100644 --- a/src/components/CollapsibleSection/index.tsx +++ b/src/components/CollapsibleSection/index.tsx @@ -7,7 +7,7 @@ import Text from '@components/Text'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; import Collapsible from './Collapsible'; type CollapsibleSectionProps = ChildrenProps & { diff --git a/src/components/ComposeProviders.tsx b/src/components/ComposeProviders.tsx index 2c73719358d8..8fc487c78251 100644 --- a/src/components/ComposeProviders.tsx +++ b/src/components/ComposeProviders.tsx @@ -1,5 +1,6 @@ -import React, {ComponentType, ReactNode} from 'react'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {ComponentType, ReactNode} from 'react'; +import React from 'react'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type ComposeProvidersProps = ChildrenProps & { /** Provider components go here */ diff --git a/src/components/Composer/index.android.tsx b/src/components/Composer/index.android.tsx index 46c2a5f06ded..d60a41e0f263 100644 --- a/src/components/Composer/index.android.tsx +++ b/src/components/Composer/index.android.tsx @@ -1,10 +1,12 @@ -import React, {ForwardedRef, useCallback, useEffect, useMemo, useRef} from 'react'; -import {StyleSheet, TextInput} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {useCallback, useEffect, useMemo, useRef} from 'react'; +import type {TextInput} from 'react-native'; +import {StyleSheet} from 'react-native'; import RNTextInput from '@components/RNTextInput'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ComposerUtils from '@libs/ComposerUtils'; -import {ComposerProps} from './types'; +import type {ComposerProps} from './types'; function Composer( { diff --git a/src/components/Composer/index.ios.tsx b/src/components/Composer/index.ios.tsx index 240dfabded0b..b1357fef9a46 100644 --- a/src/components/Composer/index.ios.tsx +++ b/src/components/Composer/index.ios.tsx @@ -1,10 +1,12 @@ -import React, {ForwardedRef, useCallback, useEffect, useMemo, useRef} from 'react'; -import {StyleSheet, TextInput} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {useCallback, useEffect, useMemo, useRef} from 'react'; +import type {TextInput} from 'react-native'; +import {StyleSheet} from 'react-native'; import RNTextInput from '@components/RNTextInput'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ComposerUtils from '@libs/ComposerUtils'; -import {ComposerProps} from './types'; +import type {ComposerProps} from './types'; function Composer( { diff --git a/src/components/Composer/index.tsx b/src/components/Composer/index.tsx index 4ff5c6dbd75f..19b7bb6bb30a 100755 --- a/src/components/Composer/index.tsx +++ b/src/components/Composer/index.tsx @@ -1,9 +1,11 @@ import {useNavigation} from '@react-navigation/native'; import ExpensiMark from 'expensify-common/lib/ExpensiMark'; -import React, {BaseSyntheticEvent, ForwardedRef, useCallback, useEffect, useMemo, useRef, useState} from 'react'; +import type {BaseSyntheticEvent, ForwardedRef} from 'react'; +import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {flushSync} from 'react-dom'; -import {DimensionValue, NativeSyntheticEvent, Text as RNText, StyleSheet, TextInput, TextInputKeyPressEventData, TextInputProps, TextInputSelectionChangeEventData, View} from 'react-native'; -import {AnimatedProps} from 'react-native-reanimated'; +import type {DimensionValue, NativeSyntheticEvent, Text as RNText, TextInput, TextInputKeyPressEventData, TextInputProps, TextInputSelectionChangeEventData} from 'react-native'; +import {StyleSheet, View} from 'react-native'; +import type {AnimatedProps} from 'react-native-reanimated'; import RNTextInput from '@components/RNTextInput'; import Text from '@components/Text'; import useIsScrollBarVisible from '@hooks/useIsScrollBarVisible'; @@ -17,7 +19,7 @@ import updateIsFullComposerAvailable from '@libs/ComposerUtils/updateIsFullCompo import isEnterWhileComposition from '@libs/KeyboardShortcut/isEnterWhileComposition'; import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager'; import CONST from '@src/CONST'; -import {ComposerProps} from './types'; +import type {ComposerProps} from './types'; /** * Retrieves the characters from the specified cursor position up to the next space or new line. diff --git a/src/components/Composer/types.ts b/src/components/Composer/types.ts index cc0654b68019..bfdcb6715d40 100644 --- a/src/components/Composer/types.ts +++ b/src/components/Composer/types.ts @@ -1,4 +1,4 @@ -import {NativeSyntheticEvent, StyleProp, TextInputFocusEventData, TextInputKeyPressEventData, TextInputSelectionChangeEventData, TextStyle} from 'react-native'; +import type {NativeSyntheticEvent, StyleProp, TextInputFocusEventData, TextInputKeyPressEventData, TextInputSelectionChangeEventData, TextStyle} from 'react-native'; type TextSelection = { start: number; diff --git a/src/components/ConfirmContent.tsx b/src/components/ConfirmContent.tsx index 9e4ffa8720da..94146a2c2957 100644 --- a/src/components/ConfirmContent.tsx +++ b/src/components/ConfirmContent.tsx @@ -1,11 +1,13 @@ -import React, {ReactNode} from 'react'; -import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'; +import type {ReactNode} from 'react'; +import React from 'react'; +import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; import Button from './Button'; import Header from './Header'; import Icon from './Icon'; diff --git a/src/components/ConfirmationPage.tsx b/src/components/ConfirmationPage.tsx index 21813edd693d..fe4036a4435f 100644 --- a/src/components/ConfirmationPage.tsx +++ b/src/components/ConfirmationPage.tsx @@ -5,7 +5,7 @@ import Button from './Button'; import FixedFooter from './FixedFooter'; import Lottie from './Lottie'; import LottieAnimations from './LottieAnimations'; -import DotLottieAnimation from './LottieAnimations/types'; +import type DotLottieAnimation from './LottieAnimations/types'; import Text from './Text'; type ConfirmationPageProps = { diff --git a/src/components/CopyTextToClipboard.tsx b/src/components/CopyTextToClipboard.tsx index 6f3b42e88fee..3c99a85fd0e7 100644 --- a/src/components/CopyTextToClipboard.tsx +++ b/src/components/CopyTextToClipboard.tsx @@ -1,5 +1,5 @@ import React, {useCallback} from 'react'; -import {AccessibilityRole, StyleProp, TextStyle} from 'react-native'; +import type {AccessibilityRole, StyleProp, TextStyle} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import Clipboard from '@libs/Clipboard'; import * as Expensicons from './Icon/Expensicons'; diff --git a/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx b/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx index 02c308705994..367e54e8be64 100644 --- a/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx +++ b/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {View} from 'react-native'; import {Circle, Rect} from 'react-native-svg'; -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import SkeletonViewContentLoader from '@components/SkeletonViewContentLoader'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; diff --git a/src/components/CurrentWalletBalance.tsx b/src/components/CurrentWalletBalance.tsx index 28a83fb1ae50..8761b50465f3 100644 --- a/src/components/CurrentWalletBalance.tsx +++ b/src/components/CurrentWalletBalance.tsx @@ -1,10 +1,11 @@ import React from 'react'; -import {StyleProp, TextStyle} from 'react-native'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {StyleProp, TextStyle} from 'react-native'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import useThemeStyles from '@hooks/useThemeStyles'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import ONYXKEYS from '@src/ONYXKEYS'; -import UserWallet from '@src/types/onyx/UserWallet'; +import type UserWallet from '@src/types/onyx/UserWallet'; import Text from './Text'; type CurrentWalletBalanceOnyxProps = { diff --git a/src/components/CustomDevMenu/index.native.tsx b/src/components/CustomDevMenu/index.native.tsx index d8a0ea987171..54f1336b4fef 100644 --- a/src/components/CustomDevMenu/index.native.tsx +++ b/src/components/CustomDevMenu/index.native.tsx @@ -1,7 +1,7 @@ import {useEffect} from 'react'; import DevMenu from 'react-native-dev-menu'; import toggleTestToolsModal from '@userActions/TestTool'; -import CustomDevMenuElement from './types'; +import type CustomDevMenuElement from './types'; const CustomDevMenu: CustomDevMenuElement = Object.assign( () => { diff --git a/src/components/CustomDevMenu/index.tsx b/src/components/CustomDevMenu/index.tsx index c8eae861b676..4306d0cae090 100644 --- a/src/components/CustomDevMenu/index.tsx +++ b/src/components/CustomDevMenu/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import CustomDevMenuElement from './types'; +import type CustomDevMenuElement from './types'; const CustomDevMenu: CustomDevMenuElement = Object.assign(() => <>, {displayName: 'CustomDevMenu'}); diff --git a/src/components/CustomDevMenu/types.ts b/src/components/CustomDevMenu/types.ts index bdfc800a17f0..17e2b30ef4f6 100644 --- a/src/components/CustomDevMenu/types.ts +++ b/src/components/CustomDevMenu/types.ts @@ -1,4 +1,4 @@ -import {ReactElement} from 'react'; +import type {ReactElement} from 'react'; type CustomDevMenuElement = { (): ReactElement; diff --git a/src/components/CustomStatusBarAndBackground/updateGlobalBackgroundColor/index.website.ts b/src/components/CustomStatusBarAndBackground/updateGlobalBackgroundColor/index.website.ts index 481d866dbe4f..f92016048bde 100644 --- a/src/components/CustomStatusBarAndBackground/updateGlobalBackgroundColor/index.website.ts +++ b/src/components/CustomStatusBarAndBackground/updateGlobalBackgroundColor/index.website.ts @@ -1,4 +1,4 @@ -import UpdateGlobalBackgroundColor from './types'; +import type UpdateGlobalBackgroundColor from './types'; const updateGlobalBackgroundColor: UpdateGlobalBackgroundColor = (theme) => { const htmlElement = document.getElementsByTagName('html')[0]; diff --git a/src/components/CustomStatusBarAndBackground/updateGlobalBackgroundColor/types.ts b/src/components/CustomStatusBarAndBackground/updateGlobalBackgroundColor/types.ts index 83bd36a9428a..078703e3846d 100644 --- a/src/components/CustomStatusBarAndBackground/updateGlobalBackgroundColor/types.ts +++ b/src/components/CustomStatusBarAndBackground/updateGlobalBackgroundColor/types.ts @@ -1,4 +1,4 @@ -import {ThemeColors} from '@styles/theme/types'; +import type {ThemeColors} from '@styles/theme/types'; type UpdateGlobalBackgroundColor = (theme: ThemeColors) => void; diff --git a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.android.ts b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.android.ts index b7651d4549de..c25f45bfb050 100644 --- a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.android.ts +++ b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.android.ts @@ -1,5 +1,5 @@ import StatusBar from '@libs/StatusBar'; -import UpdateStatusBarAppearanceProps from './types'; +import type UpdateStatusBarAppearanceProps from './types'; // eslint-disable-next-line @typescript-eslint/naming-convention export default function updateStatusBarAppearance({statusBarStyle}: UpdateStatusBarAppearanceProps) { diff --git a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ios.ts b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ios.ts index 61fcb056bba5..e887b5f0a98b 100644 --- a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ios.ts +++ b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ios.ts @@ -1,5 +1,5 @@ import StatusBar from '@libs/StatusBar'; -import UpdateStatusBarAppearanceProps from './types'; +import type UpdateStatusBarAppearanceProps from './types'; // eslint-disable-next-line @typescript-eslint/naming-convention export default function updateStatusBarAppearance({statusBarStyle}: UpdateStatusBarAppearanceProps) { diff --git a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ts b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ts index 574efd90f0b5..a11b3619f8d9 100644 --- a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ts +++ b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ts @@ -1,5 +1,5 @@ import StatusBar from '@libs/StatusBar'; -import UpdateStatusBarAppearanceProps from './types'; +import type UpdateStatusBarAppearanceProps from './types'; export default function updateStatusBarAppearance({backgroundColor, statusBarStyle}: UpdateStatusBarAppearanceProps) { if (backgroundColor) { diff --git a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/types.ts b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/types.ts index 823f0059eccf..775082187395 100644 --- a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/types.ts +++ b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/types.ts @@ -1,4 +1,4 @@ -import {StatusBarStyle} from '@styles/index'; +import type {StatusBarStyle} from '@styles/index'; type UpdateStatusBarAppearanceProps = { backgroundColor?: string; diff --git a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx index 0e8996bf5022..27d8027bbcff 100644 --- a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx +++ b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx @@ -1,6 +1,7 @@ import React from 'react'; import {View} from 'react-native'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import * as Illustrations from '@components/Icon/Illustrations'; @@ -12,7 +13,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import * as OnyxTypes from '@src/types/onyx'; +import type * as OnyxTypes from '@src/types/onyx'; type DeeplinkRedirectLoadingIndicatorOnyxProps = { /** Current user session */ diff --git a/src/components/DeeplinkWrapper/index.tsx b/src/components/DeeplinkWrapper/index.tsx index 4b0382bd6b14..076e6b91460d 100644 --- a/src/components/DeeplinkWrapper/index.tsx +++ b/src/components/DeeplinkWrapper/index.tsx @@ -1,4 +1,4 @@ -import DeeplinkWrapperProps from './types'; +import type DeeplinkWrapperProps from './types'; function DeeplinkWrapper({children}: DeeplinkWrapperProps) { return children; diff --git a/src/components/DeeplinkWrapper/index.website.tsx b/src/components/DeeplinkWrapper/index.website.tsx index 2cae91e2f2a0..1d509666ec98 100644 --- a/src/components/DeeplinkWrapper/index.website.tsx +++ b/src/components/DeeplinkWrapper/index.website.tsx @@ -8,7 +8,7 @@ import * as App from '@userActions/App'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; -import DeeplinkWrapperProps from './types'; +import type DeeplinkWrapperProps from './types'; function isMacOSWeb(): boolean { return !Browser.isMobile() && typeof navigator === 'object' && typeof navigator.userAgent === 'string' && /Mac/i.test(navigator.userAgent) && !/Electron/i.test(navigator.userAgent); diff --git a/src/components/DeeplinkWrapper/types.ts b/src/components/DeeplinkWrapper/types.ts index dfd56b62573d..db61e5b01c24 100644 --- a/src/components/DeeplinkWrapper/types.ts +++ b/src/components/DeeplinkWrapper/types.ts @@ -1,4 +1,4 @@ -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type DeeplinkWrapperProps = ChildrenProps & { /** User authentication status */ diff --git a/src/components/DisplayNames/DisplayNamesTooltipItem.tsx b/src/components/DisplayNames/DisplayNamesTooltipItem.tsx index 17bc65b88e9f..9b3eaeb4e447 100644 --- a/src/components/DisplayNames/DisplayNamesTooltipItem.tsx +++ b/src/components/DisplayNames/DisplayNamesTooltipItem.tsx @@ -1,9 +1,10 @@ -import React, {RefObject, useCallback} from 'react'; -import {Text as RNText, StyleProp, TextStyle} from 'react-native'; +import type {RefObject} from 'react'; +import React, {useCallback} from 'react'; +import type {Text as RNText, StyleProp, TextStyle} from 'react-native'; import Text from '@components/Text'; import UserDetailsTooltip from '@components/UserDetailsTooltip'; import useThemeStyles from '@hooks/useThemeStyles'; -import {AvatarSource} from '@libs/UserUtils'; +import type {AvatarSource} from '@libs/UserUtils'; type DisplayNamesTooltipItemProps = { index?: number; diff --git a/src/components/DisplayNames/DisplayNamesWithTooltip.tsx b/src/components/DisplayNames/DisplayNamesWithTooltip.tsx index 06fd0574c85e..f22b1f0c2209 100644 --- a/src/components/DisplayNames/DisplayNamesWithTooltip.tsx +++ b/src/components/DisplayNames/DisplayNamesWithTooltip.tsx @@ -1,10 +1,11 @@ import React, {Fragment, useCallback, useRef} from 'react'; -import {Text as RNText, View} from 'react-native'; +import type {Text as RNText} from 'react-native'; +import {View} from 'react-native'; import Text from '@components/Text'; import Tooltip from '@components/Tooltip'; import useThemeStyles from '@hooks/useThemeStyles'; import DisplayNamesTooltipItem from './DisplayNamesTooltipItem'; -import DisplayNamesProps from './types'; +import type DisplayNamesProps from './types'; type HTMLElementWithText = HTMLElement & RNText; diff --git a/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx b/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx index 761b0b66ee2c..177bdb6a9fc4 100644 --- a/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx +++ b/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import {StyleProp, TextStyle} from 'react-native'; +import type {StyleProp, TextStyle} from 'react-native'; import Text from '@components/Text'; import useThemeStyles from '@hooks/useThemeStyles'; diff --git a/src/components/DisplayNames/index.native.tsx b/src/components/DisplayNames/index.native.tsx index 8f1fef37a6ba..b3eceb794bcb 100644 --- a/src/components/DisplayNames/index.native.tsx +++ b/src/components/DisplayNames/index.native.tsx @@ -1,7 +1,7 @@ import React from 'react'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; -import DisplayNamesProps from './types'; +import type DisplayNamesProps from './types'; // As we don't have to show tooltips of the Native platform so we simply render the full display names list. function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfLines = 1}: DisplayNamesProps) { diff --git a/src/components/DisplayNames/index.tsx b/src/components/DisplayNames/index.tsx index 7ff1081937d5..155193368cc5 100644 --- a/src/components/DisplayNames/index.tsx +++ b/src/components/DisplayNames/index.tsx @@ -2,7 +2,7 @@ import React from 'react'; import useLocalize from '@hooks/useLocalize'; import DisplayNamesWithoutTooltip from './DisplayNamesWithoutTooltip'; import DisplayNamesWithToolTip from './DisplayNamesWithTooltip'; -import DisplayNamesProps from './types'; +import type DisplayNamesProps from './types'; function DisplayNames({fullTitle, tooltipEnabled, textStyles, numberOfLines, shouldUseFullTitle, displayNamesWithTooltips}: DisplayNamesProps) { const {translate} = useLocalize(); diff --git a/src/components/DisplayNames/types.ts b/src/components/DisplayNames/types.ts index 5137d6f54108..b0959d43aa96 100644 --- a/src/components/DisplayNames/types.ts +++ b/src/components/DisplayNames/types.ts @@ -1,4 +1,4 @@ -import {StyleProp, TextStyle} from 'react-native'; +import type {StyleProp, TextStyle} from 'react-native'; import type {AvatarSource} from '@libs/UserUtils'; type DisplayNameWithTooltip = { diff --git a/src/components/DistanceMapView/index.android.tsx b/src/components/DistanceMapView/index.android.tsx index 38e92163c3eb..168a480c6100 100644 --- a/src/components/DistanceMapView/index.android.tsx +++ b/src/components/DistanceMapView/index.android.tsx @@ -6,7 +6,7 @@ import MapView from '@components/MapView'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; -import DistanceMapViewProps from './types'; +import type DistanceMapViewProps from './types'; function DistanceMapView({overlayStyle, ...rest}: DistanceMapViewProps) { const styles = useThemeStyles(); diff --git a/src/components/DistanceMapView/index.tsx b/src/components/DistanceMapView/index.tsx index 2abdc29865b0..3f1b3b8439ed 100644 --- a/src/components/DistanceMapView/index.tsx +++ b/src/components/DistanceMapView/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import MapView from '@components/MapView'; -import DistanceMapViewProps from './types'; +import type DistanceMapViewProps from './types'; function DistanceMapView({overlayStyle, ...rest}: DistanceMapViewProps) { // eslint-disable-next-line react/jsx-props-no-spreading diff --git a/src/components/DistanceMapView/types.ts b/src/components/DistanceMapView/types.ts index 5ab3dbd8238e..18213235445f 100644 --- a/src/components/DistanceMapView/types.ts +++ b/src/components/DistanceMapView/types.ts @@ -1,4 +1,4 @@ -import {StyleProp, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; import type {MapViewProps} from '@components/MapView/MapViewTypes'; type DistanceMapViewProps = MapViewProps & { diff --git a/src/components/DotIndicatorMessage.tsx b/src/components/DotIndicatorMessage.tsx index 2787804c5f76..d18704fdfb05 100644 --- a/src/components/DotIndicatorMessage.tsx +++ b/src/components/DotIndicatorMessage.tsx @@ -1,6 +1,7 @@ /* eslint-disable react/no-array-index-key */ import React from 'react'; -import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'; +import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; diff --git a/src/components/DragAndDrop/Consumer/types.ts b/src/components/DragAndDrop/Consumer/types.ts index 1f85f32a0153..03bdee3f23d8 100644 --- a/src/components/DragAndDrop/Consumer/types.ts +++ b/src/components/DragAndDrop/Consumer/types.ts @@ -1,4 +1,4 @@ -import {ReactNode} from 'react'; +import type {ReactNode} from 'react'; type DragAndDropConsumerProps = { /** Children to render inside this component. */ diff --git a/src/components/DragAndDrop/NoDropZone/types.ts b/src/components/DragAndDrop/NoDropZone/types.ts index 09715ecd942f..0735f4936ada 100644 --- a/src/components/DragAndDrop/NoDropZone/types.ts +++ b/src/components/DragAndDrop/NoDropZone/types.ts @@ -1,4 +1,4 @@ -import {ReactNode} from 'react'; +import type {ReactNode} from 'react'; type NoDropZoneProps = { /** Content */ diff --git a/src/components/DragAndDrop/Provider/types.ts b/src/components/DragAndDrop/Provider/types.ts index eae83d10682a..b4394056cac5 100644 --- a/src/components/DragAndDrop/Provider/types.ts +++ b/src/components/DragAndDrop/Provider/types.ts @@ -1,4 +1,4 @@ -import {ReactNode} from 'react'; +import type {ReactNode} from 'react'; type DragAndDropProviderProps = { /** Children to render inside this component. */ diff --git a/src/components/DraggableList/index.native.tsx b/src/components/DraggableList/index.native.tsx index f532b21720da..7cf33112bece 100644 --- a/src/components/DraggableList/index.native.tsx +++ b/src/components/DraggableList/index.native.tsx @@ -1,6 +1,6 @@ import React from 'react'; import DraggableFlatList from 'react-native-draggable-flatlist'; -import {FlatList} from 'react-native-gesture-handler'; +import type {FlatList} from 'react-native-gesture-handler'; import useThemeStyles from '@hooks/useThemeStyles'; import type {DraggableListProps} from './types'; diff --git a/src/components/DraggableList/index.tsx b/src/components/DraggableList/index.tsx index b92691075424..dc78a3ce6222 100644 --- a/src/components/DraggableList/index.tsx +++ b/src/components/DraggableList/index.tsx @@ -1,5 +1,6 @@ import React, {useCallback} from 'react'; -import {DragDropContext, Draggable, Droppable, type OnDragEndResponder} from 'react-beautiful-dnd'; +import {DragDropContext, Draggable, Droppable} from 'react-beautiful-dnd'; +import type {OnDragEndResponder} from 'react-beautiful-dnd'; import {ScrollView} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import type {DraggableListProps} from './types'; diff --git a/src/components/EmojiSuggestions.tsx b/src/components/EmojiSuggestions.tsx index 2fcf8e827b4e..5904b1521f98 100644 --- a/src/components/EmojiSuggestions.tsx +++ b/src/components/EmojiSuggestions.tsx @@ -1,4 +1,5 @@ -import React, {ReactElement, useCallback} from 'react'; +import type {ReactElement} from 'react'; +import React, {useCallback} from 'react'; import {View} from 'react-native'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; diff --git a/src/components/ErrorBoundary/BaseErrorBoundary.tsx b/src/components/ErrorBoundary/BaseErrorBoundary.tsx index 2a6524d5a993..6a0f1a0ae55e 100644 --- a/src/components/ErrorBoundary/BaseErrorBoundary.tsx +++ b/src/components/ErrorBoundary/BaseErrorBoundary.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {ErrorBoundary} from 'react-error-boundary'; import BootSplash from '@libs/BootSplash'; import GenericErrorPage from '@pages/ErrorPage/GenericErrorPage'; -import {BaseErrorBoundaryProps, LogError} from './types'; +import type {BaseErrorBoundaryProps, LogError} from './types'; /** * This component captures an error in the child component tree and logs it to the server diff --git a/src/components/ErrorBoundary/index.native.tsx b/src/components/ErrorBoundary/index.native.tsx index b8e56ee528c2..5e0c9ca9af38 100644 --- a/src/components/ErrorBoundary/index.native.tsx +++ b/src/components/ErrorBoundary/index.native.tsx @@ -2,7 +2,7 @@ import crashlytics from '@react-native-firebase/crashlytics'; import React from 'react'; import Log from '@libs/Log'; import BaseErrorBoundary from './BaseErrorBoundary'; -import {BaseErrorBoundaryProps, LogError} from './types'; +import type {BaseErrorBoundaryProps, LogError} from './types'; const logError: LogError = (errorMessage, error, errorInfo) => { // Log the error to the server diff --git a/src/components/ErrorBoundary/index.tsx b/src/components/ErrorBoundary/index.tsx index fce70674dd97..890cf5f4e587 100644 --- a/src/components/ErrorBoundary/index.tsx +++ b/src/components/ErrorBoundary/index.tsx @@ -1,7 +1,7 @@ import React from 'react'; import Log from '@libs//Log'; import BaseErrorBoundary from './BaseErrorBoundary'; -import {BaseErrorBoundaryProps, LogError} from './types'; +import type {BaseErrorBoundaryProps, LogError} from './types'; const logError: LogError = (errorMessage, error, errorInfo) => { // Log the error to the server diff --git a/src/components/ExpensifyWordmark.tsx b/src/components/ExpensifyWordmark.tsx index 798907c7eeb6..0e8f78686b07 100644 --- a/src/components/ExpensifyWordmark.tsx +++ b/src/components/ExpensifyWordmark.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import AdHocLogo from '@assets/images/expensify-logo--adhoc.svg'; import DevLogo from '@assets/images/expensify-logo--dev.svg'; import StagingLogo from '@assets/images/expensify-logo--staging.svg'; diff --git a/src/components/FixedFooter.tsx b/src/components/FixedFooter.tsx index 7fd6811c1df6..35fa4d02f5e0 100644 --- a/src/components/FixedFooter.tsx +++ b/src/components/FixedFooter.tsx @@ -1,5 +1,7 @@ -import React, {ReactNode} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {ReactNode} from 'react'; +import React from 'react'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; type FixedFooterProps = { diff --git a/src/components/FlatList/index.android.tsx b/src/components/FlatList/index.android.tsx index 84345f6e0ed4..863930203863 100644 --- a/src/components/FlatList/index.android.tsx +++ b/src/components/FlatList/index.android.tsx @@ -1,6 +1,8 @@ import {useFocusEffect} from '@react-navigation/native'; -import React, {ForwardedRef, forwardRef, useCallback, useContext} from 'react'; -import {FlatList, FlatListProps} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef, useCallback, useContext} from 'react'; +import type {FlatListProps} from 'react-native'; +import {FlatList} from 'react-native'; import {ActionListContext} from '@pages/home/ReportScreenContext'; // FlatList wrapped with the freeze component will lose its scroll state when frozen (only for Android). diff --git a/src/components/FormAlertWithSubmitButton.tsx b/src/components/FormAlertWithSubmitButton.tsx index d8e30b27371d..512d2063dc0f 100644 --- a/src/components/FormAlertWithSubmitButton.tsx +++ b/src/components/FormAlertWithSubmitButton.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import Button from './Button'; import FormAlertWrapper from './FormAlertWrapper'; diff --git a/src/components/FormAlertWrapper.tsx b/src/components/FormAlertWrapper.tsx index a144bf069502..65fa2311620d 100644 --- a/src/components/FormAlertWrapper.tsx +++ b/src/components/FormAlertWrapper.tsx @@ -1,8 +1,10 @@ -import React, {ReactNode} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {ReactNode} from 'react'; +import React from 'react'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import Network from '@src/types/onyx/Network'; +import type Network from '@src/types/onyx/Network'; import FormHelpMessage from './FormHelpMessage'; import {withNetwork} from './OnyxProvider'; import RenderHTML from './RenderHTML'; diff --git a/src/components/FormElement.tsx b/src/components/FormElement.tsx index c61a09b9d1ec..da98d4dc565a 100644 --- a/src/components/FormElement.tsx +++ b/src/components/FormElement.tsx @@ -1,5 +1,7 @@ -import React, {ForwardedRef, forwardRef} from 'react'; -import {View, ViewProps} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef} from 'react'; +import type {ViewProps} from 'react-native'; +import {View} from 'react-native'; import * as ComponentUtils from '@libs/ComponentUtils'; function FormElement(props: ViewProps, ref: ForwardedRef) { diff --git a/src/components/FormHelpMessage.tsx b/src/components/FormHelpMessage.tsx index 43709b51db44..4f1d784788bf 100644 --- a/src/components/FormHelpMessage.tsx +++ b/src/components/FormHelpMessage.tsx @@ -1,6 +1,7 @@ import isEmpty from 'lodash/isEmpty'; import React from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Localize from '@libs/Localize'; diff --git a/src/components/FormScrollView.tsx b/src/components/FormScrollView.tsx index 4646a534e750..ade167e9e628 100644 --- a/src/components/FormScrollView.tsx +++ b/src/components/FormScrollView.tsx @@ -1,5 +1,7 @@ -import React, {ForwardedRef} from 'react'; -import {ScrollView, ScrollViewProps} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React from 'react'; +import type {ScrollViewProps} from 'react-native'; +import {ScrollView} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; type FormScrollViewProps = ScrollViewProps & { diff --git a/src/components/FormSubmit/index.native.tsx b/src/components/FormSubmit/index.native.tsx index 22bf5353949d..5eae7b51d988 100644 --- a/src/components/FormSubmit/index.native.tsx +++ b/src/components/FormSubmit/index.native.tsx @@ -1,6 +1,6 @@ import React from 'react'; import {View} from 'react-native'; -import {FormSubmitProps, FormSubmitRef} from './types'; +import type {FormSubmitProps, FormSubmitRef} from './types'; function FormSubmit({style, children}: FormSubmitProps, ref: FormSubmitRef) { return ( diff --git a/src/components/FormSubmit/index.tsx b/src/components/FormSubmit/index.tsx index ef3f3c39bbaa..2ccd006bf322 100644 --- a/src/components/FormSubmit/index.tsx +++ b/src/components/FormSubmit/index.tsx @@ -1,9 +1,10 @@ -import React, {KeyboardEvent, useEffect} from 'react'; +import type {KeyboardEvent} from 'react'; +import React, {useEffect} from 'react'; import {View} from 'react-native'; import * as ComponentUtils from '@libs/ComponentUtils'; import isEnterWhileComposition from '@libs/KeyboardShortcut/isEnterWhileComposition'; import CONST from '@src/CONST'; -import {FormSubmitProps, FormSubmitRef} from './types'; +import type {FormSubmitProps, FormSubmitRef} from './types'; function FormSubmit({children, onSubmit, style}: FormSubmitProps, ref: FormSubmitRef) { /** diff --git a/src/components/FormSubmit/types.ts b/src/components/FormSubmit/types.ts index 20910647ecb8..722a3fbf746e 100644 --- a/src/components/FormSubmit/types.ts +++ b/src/components/FormSubmit/types.ts @@ -1,5 +1,6 @@ -import React, {ForwardedRef} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {ForwardedRef} from 'react'; +import type React from 'react'; +import type {StyleProp, View, ViewStyle} from 'react-native'; type FormSubmitProps = { children: React.ReactNode; diff --git a/src/components/FullscreenLoadingIndicator.tsx b/src/components/FullscreenLoadingIndicator.tsx index 2b5f7b3ada72..bd3082db5fa4 100644 --- a/src/components/FullscreenLoadingIndicator.tsx +++ b/src/components/FullscreenLoadingIndicator.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {ActivityIndicator, StyleProp, StyleSheet, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {ActivityIndicator, StyleSheet, View} from 'react-native'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; diff --git a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js index 0b5cbad29983..f9b70e43e279 100755 --- a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js +++ b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js @@ -62,7 +62,7 @@ function BaseHTMLEngineProvider(props) { 'mention-here': defaultHTMLElementModels.span.extend({tagName: 'mention-here'}), 'next-step': defaultHTMLElementModels.span.extend({ tagName: 'next-step', - mixedUAStyles: {...styles.textLabelSupporting}, + mixedUAStyles: {...styles.textLabelSupporting, ...styles.lh16}, }), 'next-step-email': defaultHTMLElementModels.span.extend({tagName: 'next-step-email'}), video: defaultHTMLElementModels.div.extend({ @@ -70,7 +70,7 @@ function BaseHTMLEngineProvider(props) { mixedUAStyles: {whiteSpace: 'pre'}, }), }), - [styles.colorMuted, styles.formError, styles.mb0, styles.textLabelSupporting], + [styles.colorMuted, styles.formError, styles.mb0, styles.textLabelSupporting, styles.lh16], ); // We need to memoize this prop to make it referentially stable. diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/BasePreRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.js similarity index 76% rename from src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/BasePreRenderer.js rename to src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.js index 07954cc97a00..27eff02d63ea 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/BasePreRenderer.js +++ b/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.js @@ -1,14 +1,14 @@ import PropTypes from 'prop-types'; -import React, {forwardRef} from 'react'; -import {ScrollView, View} from 'react-native'; +import React from 'react'; +import {View} from 'react-native'; import _ from 'underscore'; -import htmlRendererPropTypes from '@components/HTMLEngineProvider/HTMLRenderers/htmlRendererPropTypes'; import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; import {ShowContextMenuContext, showContextMenuForReport} from '@components/ShowContextMenuContext'; import withLocalize from '@components/withLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; +import htmlRendererPropTypes from './htmlRendererPropTypes'; const propTypes = { /** Press in handler for the code block */ @@ -31,20 +31,14 @@ const defaultProps = { onPressOut: undefined, }; -const BasePreRenderer = forwardRef((props, ref) => { +function PreRenderer(props) { const styles = useThemeStyles(); const TDefaultRenderer = props.TDefaultRenderer; const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'onPressIn', 'onPressOut', 'onLongPress']); const isLast = props.renderIndex === props.renderLength - 1; return ( - + {({anchor, report, action, checkIfContextMenuActive}) => ( { )} - + ); -}); +} -BasePreRenderer.displayName = 'BasePreRenderer'; -BasePreRenderer.propTypes = propTypes; -BasePreRenderer.defaultProps = defaultProps; +PreRenderer.displayName = 'PreRenderer'; +PreRenderer.propTypes = propTypes; +PreRenderer.defaultProps = defaultProps; -export default withLocalize(BasePreRenderer); +export default withLocalize(PreRenderer); diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/index.js b/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/index.js deleted file mode 100644 index 3beb52e6ee81..000000000000 --- a/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/index.js +++ /dev/null @@ -1,68 +0,0 @@ -import React, {useCallback, useEffect, useRef} from 'react'; -import _ from 'underscore'; -import htmlRendererPropTypes from '@components/HTMLEngineProvider/HTMLRenderers/htmlRendererPropTypes'; -import ControlSelection from '@libs/ControlSelection'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; -import BasePreRenderer from './BasePreRenderer'; - -const supportsPassive = DeviceCapabilities.hasPassiveEventListenerSupport(); - -const isScrollingVertically = (event) => - // Mark as vertical scrolling only when absolute value of deltaY is more than the double of absolute - // value of deltaX, so user can use trackpad scroll on the code block horizontally at a wide angle. - Math.abs(event.deltaY) > Math.abs(event.deltaX) * 2; - -const debouncedIsScrollingVertically = _.debounce(isScrollingVertically, 100, true); - -function PreRenderer(props) { - const scrollViewRef = useRef(); - - /** - * Checks if user is scrolling vertically based on deltaX and deltaY. We debounce this - * method in order to make sure it's called only for the first event. - * @param {WheelEvent} event Wheel event - * @returns {Boolean} true if user is scrolling vertically - */ - - /** - * Manually scrolls the code block if code block horizontal scrollable, then prevents the event from being passed up to the parent. - * @param {Object} event native event - */ - const scrollNode = useCallback((event) => { - const node = scrollViewRef.current.getScrollableNode(); - const horizontalOverflow = node.scrollWidth > node.offsetWidth; - if (event.currentTarget === node && horizontalOverflow && !debouncedIsScrollingVertically(event)) { - node.scrollLeft += event.deltaX; - } - }, []); - - useEffect(() => { - const eventListenerRefValue = scrollViewRef.current; - if (!eventListenerRefValue) { - return; - } - eventListenerRefValue.getScrollableNode().addEventListener('wheel', scrollNode, supportsPassive ? {passive: true} : false); - - return () => { - if (!eventListenerRefValue.getScrollableNode()) { - return; - } - eventListenerRefValue.getScrollableNode().removeEventListener('wheel', scrollNode); - }; - }, [scrollNode]); - - return ( - DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()} - onPressOut={ControlSelection.unblock} - /> - ); -} - -PreRenderer.propTypes = htmlRendererPropTypes; -PreRenderer.displayName = 'PreRenderer'; - -export default PreRenderer; diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/index.native.js b/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/index.native.js deleted file mode 100644 index b84dd43dd82f..000000000000 --- a/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/index.native.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import htmlRendererPropTypes from '@components/HTMLEngineProvider/HTMLRenderers/htmlRendererPropTypes'; -import withLocalize from '@components/withLocalize'; -import BasePreRenderer from './BasePreRenderer'; - -function PreRenderer(props) { - // eslint-disable-next-line react/jsx-props-no-spreading - return ; -} - -PreRenderer.propTypes = htmlRendererPropTypes; -PreRenderer.displayName = 'PreRenderer'; - -export default withLocalize(PreRenderer); diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 4eac2c7a6994..25532107016f 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,5 +1,7 @@ -import React, {ReactNode} from 'react'; -import {StyleProp, TextStyle, View} from 'react-native'; +import type {ReactNode} from 'react'; +import React from 'react'; +import type {StyleProp, TextStyle} from 'react-native'; +import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import EnvironmentBadge from './EnvironmentBadge'; import Text from './Text'; diff --git a/src/components/HeaderGap/types.ts b/src/components/HeaderGap/types.ts index 55a202c2e48c..1333ceac6198 100644 --- a/src/components/HeaderGap/types.ts +++ b/src/components/HeaderGap/types.ts @@ -1,5 +1,5 @@ -import {ReactNode} from 'react'; -import {StyleProp, ViewStyle} from 'react-native'; +import type {ReactNode} from 'react'; +import type {StyleProp, ViewStyle} from 'react-native'; type HeaderGapProps = { styles?: StyleProp; diff --git a/src/components/HeaderWithBackButton/index.tsx b/src/components/HeaderWithBackButton/index.tsx index 9ec8bca55a95..209803f2a5d1 100755 --- a/src/components/HeaderWithBackButton/index.tsx +++ b/src/components/HeaderWithBackButton/index.tsx @@ -19,7 +19,7 @@ import getButtonState from '@libs/getButtonState'; import Navigation from '@libs/Navigation/Navigation'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; -import HeaderWithBackButtonProps from './types'; +import type HeaderWithBackButtonProps from './types'; function HeaderWithBackButton({ iconFill, diff --git a/src/components/HeaderWithBackButton/types.ts b/src/components/HeaderWithBackButton/types.ts index 99e93e8d18d2..9ffb0b5ef2f3 100644 --- a/src/components/HeaderWithBackButton/types.ts +++ b/src/components/HeaderWithBackButton/types.ts @@ -1,5 +1,5 @@ -import {ReactNode} from 'react'; -import {OnyxCollection, OnyxEntry} from 'react-native-onyx'; +import type {ReactNode} from 'react'; +import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; import type {Action} from '@hooks/useSingleExecution'; import type {StepCounterParams} from '@src/languages/types'; import type {AnchorPosition} from '@src/styles'; diff --git a/src/components/Hoverable/index.native.tsx b/src/components/Hoverable/index.native.tsx index b3d49db9d96e..47268e0f440a 100644 --- a/src/components/Hoverable/index.native.tsx +++ b/src/components/Hoverable/index.native.tsx @@ -1,6 +1,6 @@ import React from 'react'; import {View} from 'react-native'; -import HoverableProps from './types'; +import type HoverableProps from './types'; /** * On mobile, there is no concept of hovering, so we return a plain wrapper around the component's children, diff --git a/src/components/Hoverable/index.tsx b/src/components/Hoverable/index.tsx index 78ace63bcc35..c82ba659593a 100644 --- a/src/components/Hoverable/index.tsx +++ b/src/components/Hoverable/index.tsx @@ -1,8 +1,9 @@ -import React, {ForwardedRef, forwardRef, MutableRefObject, ReactElement, RefAttributes, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'; +import type {ForwardedRef, MutableRefObject, ReactElement, RefAttributes} from 'react'; +import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'; import {DeviceEventEmitter} from 'react-native'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import CONST from '@src/CONST'; -import HoverableProps from './types'; +import type HoverableProps from './types'; /** * Maps the children of a Hoverable component to diff --git a/src/components/Hoverable/types.ts b/src/components/Hoverable/types.ts index b4c53f2df5be..921772743ab4 100644 --- a/src/components/Hoverable/types.ts +++ b/src/components/Hoverable/types.ts @@ -1,4 +1,4 @@ -import {ReactNode} from 'react'; +import type {ReactNode} from 'react'; type HoverableProps = { /** Children to wrap with Hoverable. */ diff --git a/src/components/IFrame.tsx b/src/components/IFrame.tsx index 7520ad869507..ab27597aeebd 100644 --- a/src/components/IFrame.tsx +++ b/src/components/IFrame.tsx @@ -1,7 +1,8 @@ import React, {useEffect, useState} from 'react'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Session} from '@src/types/onyx'; +import type {Session} from '@src/types/onyx'; type OldDotIFrameOnyxProps = { session: OnyxEntry; diff --git a/src/components/Icon/BankIcons/index.native.ts b/src/components/Icon/BankIcons/index.native.ts index 2011b71588af..61721512ec04 100644 --- a/src/components/Icon/BankIcons/index.native.ts +++ b/src/components/Icon/BankIcons/index.native.ts @@ -1,9 +1,10 @@ import GenericBank from '@assets/images/bankicons/generic-bank-account.svg'; import GenericBankCard from '@assets/images/cardicons/generic-bank-card.svg'; -import {BankIconParams, getBankIconAsset, getBankNameKey} from '@components/Icon/BankIconsUtils'; +import type {BankIconParams} from '@components/Icon/BankIconsUtils'; +import {getBankIconAsset, getBankNameKey} from '@components/Icon/BankIconsUtils'; import variables from '@styles/variables'; import CONST from '@src/CONST'; -import {BankIcon} from '@src/types/onyx/Bank'; +import type {BankIcon} from '@src/types/onyx/Bank'; /** * Returns Bank Icon Object that matches to existing bank icons or default icons diff --git a/src/components/Icon/BankIcons/index.ts b/src/components/Icon/BankIcons/index.ts index 0e0935b103e4..378a7107aa03 100644 --- a/src/components/Icon/BankIcons/index.ts +++ b/src/components/Icon/BankIcons/index.ts @@ -1,10 +1,11 @@ import GenericBank from '@assets/images/bankicons/generic-bank-account.svg'; import GenericBankCard from '@assets/images/cardicons/generic-bank-card.svg'; -import {BankIconParams, getBankIconAsset, getBankNameKey} from '@components/Icon/BankIconsUtils'; +import type {BankIconParams} from '@components/Icon/BankIconsUtils'; +import {getBankIconAsset, getBankNameKey} from '@components/Icon/BankIconsUtils'; import variables from '@styles/variables'; import CONST from '@src/CONST'; -import {BankIcon} from '@src/types/onyx/Bank'; -import IconAsset from '@src/types/utils/IconAsset'; +import type {BankIcon} from '@src/types/onyx/Bank'; +import type IconAsset from '@src/types/utils/IconAsset'; /** * It's a wrapper type for a bank icon asset. Bank icons are imported using require(), on the web platform after importing in this way it's necessary to use the property "default" diff --git a/src/components/Icon/BankIconsUtils.ts b/src/components/Icon/BankIconsUtils.ts index cc877ef9ef6f..c91ec030c9ba 100644 --- a/src/components/Icon/BankIconsUtils.ts +++ b/src/components/Icon/BankIconsUtils.ts @@ -1,7 +1,7 @@ -import {type ThemeStyles} from '@styles/index'; +import type {ThemeStyles} from '@styles/index'; import CONST from '@src/CONST'; -import {BankName, BankNameKey} from '@src/types/onyx/Bank'; -import IconAsset from '@src/types/utils/IconAsset'; +import type {BankName, BankNameKey} from '@src/types/onyx/Bank'; +import type IconAsset from '@src/types/utils/IconAsset'; type BankIconParams = { styles: ThemeStyles; diff --git a/src/components/Icon/IconWrapperStyles/index.ios.ts b/src/components/Icon/IconWrapperStyles/index.ios.ts index 9507502d9d26..b039cff95f58 100644 --- a/src/components/Icon/IconWrapperStyles/index.ios.ts +++ b/src/components/Icon/IconWrapperStyles/index.ios.ts @@ -1,4 +1,4 @@ -import IconWrapperStyle from './types'; +import type IconWrapperStyle from './types'; const style: IconWrapperStyle = { top: 1, diff --git a/src/components/Icon/IconWrapperStyles/index.ts b/src/components/Icon/IconWrapperStyles/index.ts index 541a2c296c17..2c4be7b706e8 100644 --- a/src/components/Icon/IconWrapperStyles/index.ts +++ b/src/components/Icon/IconWrapperStyles/index.ts @@ -1,4 +1,4 @@ -import IconWrapperStyle from './types'; +import type IconWrapperStyle from './types'; const style: IconWrapperStyle = { top: 2, diff --git a/src/components/Icon/index.tsx b/src/components/Icon/index.tsx index 732fe90deae2..20f3fd4a8acb 100644 --- a/src/components/Icon/index.tsx +++ b/src/components/Icon/index.tsx @@ -1,11 +1,12 @@ -import {ImageContentFit} from 'expo-image'; +import type {ImageContentFit} from 'expo-image'; import React from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import ImageSVG from '@components/ImageSVG'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; import IconWrapperStyles from './IconWrapperStyles'; type IconProps = { diff --git a/src/components/ImageSVG/index.native.tsx b/src/components/ImageSVG/index.native.tsx index c397e047b7e0..bdd0b3830a22 100644 --- a/src/components/ImageSVG/index.native.tsx +++ b/src/components/ImageSVG/index.native.tsx @@ -1,7 +1,7 @@ import {Image} from 'expo-image'; import React from 'react'; -import {ImageSourcePropType} from 'react-native'; -import ImageSVGProps from './types'; +import type {ImageSourcePropType} from 'react-native'; +import type ImageSVGProps from './types'; function ImageSVG({src, width = '100%', height = '100%', fill, contentFit = 'cover', style}: ImageSVGProps) { const tintColorProp = fill ? {tintColor: fill} : {}; diff --git a/src/components/ImageSVG/index.tsx b/src/components/ImageSVG/index.tsx index 32d83fdcadd3..3ce04a1a190a 100644 --- a/src/components/ImageSVG/index.tsx +++ b/src/components/ImageSVG/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import {SvgProps} from 'react-native-svg'; -import ImageSVGProps from './types'; +import type {SvgProps} from 'react-native-svg'; +import type ImageSVGProps from './types'; function ImageSVG({src, width = '100%', height = '100%', fill, hovered = false, pressed = false, style, pointerEvents, preserveAspectRatio}: ImageSVGProps) { const ImageSvgComponent = src as React.FC; diff --git a/src/components/ImageSVG/types.ts b/src/components/ImageSVG/types.ts index cc580651c30c..341934852303 100644 --- a/src/components/ImageSVG/types.ts +++ b/src/components/ImageSVG/types.ts @@ -1,6 +1,6 @@ -import {ImageContentFit, ImageStyle} from 'expo-image'; -import {StyleProp, ViewStyle} from 'react-native'; -import IconAsset from '@src/types/utils/IconAsset'; +import type {ImageContentFit, ImageStyle} from 'expo-image'; +import type {StyleProp, ViewStyle} from 'react-native'; +import type IconAsset from '@src/types/utils/IconAsset'; type ImageSVGProps = { /** The asset to render. */ diff --git a/src/components/ImageWithSizeCalculation.tsx b/src/components/ImageWithSizeCalculation.tsx index af803bb360ee..b13d863d97e1 100644 --- a/src/components/ImageWithSizeCalculation.tsx +++ b/src/components/ImageWithSizeCalculation.tsx @@ -1,6 +1,7 @@ import delay from 'lodash/delay'; import React, {useEffect, useRef, useState} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import Log from '@libs/Log'; import FullscreenLoadingIndicator from './FullscreenLoadingIndicator'; diff --git a/src/components/Indicator.tsx b/src/components/Indicator.tsx index 7b7eae97fd86..5bf93eb8a6b3 100644 --- a/src/components/Indicator.tsx +++ b/src/components/Indicator.tsx @@ -1,7 +1,8 @@ import React from 'react'; import {StyleSheet, View} from 'react-native'; -import {OnyxCollection, withOnyx} from 'react-native-onyx'; -import {OnyxEntry} from 'react-native-onyx/lib/types'; +import type {OnyxCollection} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx/lib/types'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as PolicyUtils from '@libs/PolicyUtils'; diff --git a/src/components/InlineCodeBlock/WrappedText.tsx b/src/components/InlineCodeBlock/WrappedText.tsx index 1c66cef234ed..3c196f2a7492 100644 --- a/src/components/InlineCodeBlock/WrappedText.tsx +++ b/src/components/InlineCodeBlock/WrappedText.tsx @@ -1,5 +1,6 @@ import React, {Fragment} from 'react'; -import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'; +import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import Text from '@components/Text'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; diff --git a/src/components/InlineCodeBlock/types.ts b/src/components/InlineCodeBlock/types.ts index a100177e41a7..ae847b293a60 100644 --- a/src/components/InlineCodeBlock/types.ts +++ b/src/components/InlineCodeBlock/types.ts @@ -1,4 +1,4 @@ -import {StyleProp, TextStyle, ViewStyle} from 'react-native'; +import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; import type {TDefaultRenderer, TDefaultRendererProps, TText} from 'react-native-render-html'; type InlineCodeBlockProps = { diff --git a/src/components/InvertedFlatList/BaseInvertedFlatList.tsx b/src/components/InvertedFlatList/BaseInvertedFlatList.tsx index 08d990583572..9e3991828625 100644 --- a/src/components/InvertedFlatList/BaseInvertedFlatList.tsx +++ b/src/components/InvertedFlatList/BaseInvertedFlatList.tsx @@ -1,5 +1,6 @@ -import React, {ForwardedRef, forwardRef} from 'react'; -import {FlatListProps} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef} from 'react'; +import type {FlatListProps} from 'react-native'; import FlatList from '@components/FlatList'; const AUTOSCROLL_TO_TOP_THRESHOLD = 128; diff --git a/src/components/InvertedFlatList/CellRendererComponent.tsx b/src/components/InvertedFlatList/CellRendererComponent.tsx index 252d47989064..b95fbf42cbb4 100644 --- a/src/components/InvertedFlatList/CellRendererComponent.tsx +++ b/src/components/InvertedFlatList/CellRendererComponent.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {StyleProp, View, ViewProps} from 'react-native'; +import type {StyleProp, ViewProps} from 'react-native'; +import {View} from 'react-native'; type CellRendererComponentProps = ViewProps & { index: number; diff --git a/src/components/InvertedFlatList/index.native.tsx b/src/components/InvertedFlatList/index.native.tsx index 906ef6d6ae94..76c4b774d0cc 100644 --- a/src/components/InvertedFlatList/index.native.tsx +++ b/src/components/InvertedFlatList/index.native.tsx @@ -1,5 +1,6 @@ -import React, {ForwardedRef, forwardRef} from 'react'; -import {FlatList, FlatListProps} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef} from 'react'; +import type {FlatList, FlatListProps} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import BaseInvertedFlatList from './BaseInvertedFlatList'; import CellRendererComponent from './CellRendererComponent'; diff --git a/src/components/InvertedFlatList/index.tsx b/src/components/InvertedFlatList/index.tsx index 6871b010a385..0fc35957e687 100644 --- a/src/components/InvertedFlatList/index.tsx +++ b/src/components/InvertedFlatList/index.tsx @@ -1,5 +1,7 @@ -import React, {ForwardedRef, forwardRef, useEffect, useRef} from 'react'; -import {DeviceEventEmitter, FlatList, FlatListProps, NativeScrollEvent, NativeSyntheticEvent} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef, useEffect, useRef} from 'react'; +import type {FlatList, FlatListProps, NativeScrollEvent, NativeSyntheticEvent} from 'react-native'; +import {DeviceEventEmitter} from 'react-native'; import CONST from '@src/CONST'; import BaseInvertedFlatList from './BaseInvertedFlatList'; diff --git a/src/components/KeyboardAvoidingView/index.ios.tsx b/src/components/KeyboardAvoidingView/index.ios.tsx index fde4df6fc05b..a7cd767377ef 100644 --- a/src/components/KeyboardAvoidingView/index.ios.tsx +++ b/src/components/KeyboardAvoidingView/index.ios.tsx @@ -3,7 +3,7 @@ */ import React from 'react'; import {KeyboardAvoidingView as KeyboardAvoidingViewComponent} from 'react-native'; -import KeyboardAvoidingViewProps from './types'; +import type KeyboardAvoidingViewProps from './types'; function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) { // eslint-disable-next-line react/jsx-props-no-spreading diff --git a/src/components/KeyboardAvoidingView/index.tsx b/src/components/KeyboardAvoidingView/index.tsx index cf3a5c5ebef7..09ec21e5b219 100644 --- a/src/components/KeyboardAvoidingView/index.tsx +++ b/src/components/KeyboardAvoidingView/index.tsx @@ -3,7 +3,7 @@ */ import React from 'react'; import {View} from 'react-native'; -import KeyboardAvoidingViewProps from './types'; +import type KeyboardAvoidingViewProps from './types'; function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) { const {behavior, contentContainerStyle, enabled, keyboardVerticalOffset, ...rest} = props; diff --git a/src/components/LinearGradient/index.native.ts b/src/components/LinearGradient/index.native.ts index 46bed24ebc10..29af26b96b64 100644 --- a/src/components/LinearGradient/index.native.ts +++ b/src/components/LinearGradient/index.native.ts @@ -1,5 +1,5 @@ import LinearGradientNative from 'react-native-linear-gradient'; -import LinearGradient from './types'; +import type LinearGradient from './types'; const LinearGradientImplementation: LinearGradient = LinearGradientNative; diff --git a/src/components/LinearGradient/index.ts b/src/components/LinearGradient/index.ts index 7246ccf2fb69..84d0fc2ce5c8 100644 --- a/src/components/LinearGradient/index.ts +++ b/src/components/LinearGradient/index.ts @@ -1,5 +1,5 @@ import LinearGradientWeb from 'react-native-web-linear-gradient'; -import LinearGradient from './types'; +import type LinearGradient from './types'; const LinearGradientImplementation: LinearGradient = LinearGradientWeb; diff --git a/src/components/LinearGradient/types.ts b/src/components/LinearGradient/types.ts index cf6661eaecaa..9e238ef71f12 100644 --- a/src/components/LinearGradient/types.ts +++ b/src/components/LinearGradient/types.ts @@ -1,4 +1,4 @@ -import LinearGradientNative from 'react-native-linear-gradient'; +import type LinearGradientNative from 'react-native-linear-gradient'; type LinearGradient = typeof LinearGradientNative; diff --git a/src/components/LocaleContextProvider.tsx b/src/components/LocaleContextProvider.tsx index 3c649a8cb546..7313bb4aa7bb 100644 --- a/src/components/LocaleContextProvider.tsx +++ b/src/components/LocaleContextProvider.tsx @@ -1,6 +1,7 @@ import React, {createContext, useMemo} from 'react'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import compose from '@libs/compose'; import DateUtils from '@libs/DateUtils'; import * as LocaleDigitUtils from '@libs/LocaleDigitUtils'; @@ -8,9 +9,10 @@ import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import * as Localize from '@libs/Localize'; import * as NumberFormatUtils from '@libs/NumberFormatUtils'; import CONST from '@src/CONST'; -import {TranslationPaths} from '@src/languages/types'; +import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; -import withCurrentUserPersonalDetails, {WithCurrentUserPersonalDetailsProps} from './withCurrentUserPersonalDetails'; +import type {WithCurrentUserPersonalDetailsProps} from './withCurrentUserPersonalDetails'; +import withCurrentUserPersonalDetails from './withCurrentUserPersonalDetails'; type Locale = ValueOf; diff --git a/src/components/LocalePicker.tsx b/src/components/LocalePicker.tsx index 46adb1a4895e..3a2d9a0fd7b9 100644 --- a/src/components/LocalePicker.tsx +++ b/src/components/LocalePicker.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; diff --git a/src/components/LocationErrorMessage/BaseLocationErrorMessage.tsx b/src/components/LocationErrorMessage/BaseLocationErrorMessage.tsx index ceeb33d5e6bc..33a0bba7481c 100644 --- a/src/components/LocationErrorMessage/BaseLocationErrorMessage.tsx +++ b/src/components/LocationErrorMessage/BaseLocationErrorMessage.tsx @@ -12,7 +12,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import colors from '@styles/theme/colors'; import CONST from '@src/CONST'; -import LocationErrorMessageProps from './types'; +import type LocationErrorMessageProps from './types'; type BaseLocationErrorMessageProps = LocationErrorMessageProps & { /** A callback that runs when 'allow location permission' link is pressed */ diff --git a/src/components/LocationErrorMessage/index.native.tsx b/src/components/LocationErrorMessage/index.native.tsx index 3f3813084a47..7936fff73c06 100644 --- a/src/components/LocationErrorMessage/index.native.tsx +++ b/src/components/LocationErrorMessage/index.native.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {Linking} from 'react-native'; import BaseLocationErrorMessage from './BaseLocationErrorMessage'; -import LocationErrorMessageProps from './types'; +import type LocationErrorMessageProps from './types'; /** Opens app level settings from the native system settings */ const openAppSettings = () => { diff --git a/src/components/LocationErrorMessage/index.tsx b/src/components/LocationErrorMessage/index.tsx index bd9523ca5c1c..193d38069d65 100644 --- a/src/components/LocationErrorMessage/index.tsx +++ b/src/components/LocationErrorMessage/index.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {Linking} from 'react-native'; import CONST from '@src/CONST'; import BaseLocationErrorMessage from './BaseLocationErrorMessage'; -import LocationErrorMessageProps from './types'; +import type LocationErrorMessageProps from './types'; /** Opens expensify help site in a new browser tab */ const navigateToExpensifyHelpSite = () => { diff --git a/src/components/Lottie/index.tsx b/src/components/Lottie/index.tsx index 2bf7df056c4d..5c672cf7cab6 100644 --- a/src/components/Lottie/index.tsx +++ b/src/components/Lottie/index.tsx @@ -1,7 +1,9 @@ -import LottieView, {LottieViewProps} from 'lottie-react-native'; -import React, {ForwardedRef, forwardRef} from 'react'; +import type {LottieViewProps} from 'lottie-react-native'; +import LottieView from 'lottie-react-native'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef} from 'react'; import {View} from 'react-native'; -import DotLottieAnimation from '@components/LottieAnimations/types'; +import type DotLottieAnimation from '@components/LottieAnimations/types'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; diff --git a/src/components/LottieAnimations/index.tsx b/src/components/LottieAnimations/index.tsx index 078cdc0c6987..0d2cac253135 100644 --- a/src/components/LottieAnimations/index.tsx +++ b/src/components/LottieAnimations/index.tsx @@ -1,4 +1,4 @@ -import DotLottieAnimation from './types'; +import type DotLottieAnimation from './types'; const DotLottieAnimations: Record = { ExpensifyLounge: { diff --git a/src/components/LottieAnimations/types.ts b/src/components/LottieAnimations/types.ts index fcd793c6dfed..6000b9f853f0 100644 --- a/src/components/LottieAnimations/types.ts +++ b/src/components/LottieAnimations/types.ts @@ -1,4 +1,4 @@ -import {LottieViewProps} from 'lottie-react-native'; +import type {LottieViewProps} from 'lottie-react-native'; type DotLottieAnimation = { file: LottieViewProps['source']; diff --git a/src/components/MapView/Direction.tsx b/src/components/MapView/Direction.tsx index b3162149a48d..729d3c71e91f 100644 --- a/src/components/MapView/Direction.tsx +++ b/src/components/MapView/Direction.tsx @@ -1,6 +1,6 @@ import Mapbox from '@rnmapbox/maps'; import useThemeStyles from '@hooks/useThemeStyles'; -import {DirectionProps} from './MapViewTypes'; +import type {DirectionProps} from './MapViewTypes'; function Direction({coordinates}: DirectionProps) { const styles = useThemeStyles(); diff --git a/src/components/MapView/Direction.website.tsx b/src/components/MapView/Direction.website.tsx index f85bda125473..02fee83042a2 100644 --- a/src/components/MapView/Direction.website.tsx +++ b/src/components/MapView/Direction.website.tsx @@ -6,7 +6,7 @@ import React from 'react'; import {Layer, Source} from 'react-map-gl'; import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; -import {DirectionProps} from './MapViewTypes'; +import type {DirectionProps} from './MapViewTypes'; function Direction({coordinates}: DirectionProps) { const styles = useThemeStyles(); diff --git a/src/components/MapView/MapView.tsx b/src/components/MapView/MapView.tsx index f7a15ba10d2c..6321b461f21e 100644 --- a/src/components/MapView/MapView.tsx +++ b/src/components/MapView/MapView.tsx @@ -1,5 +1,6 @@ import {useFocusEffect, useNavigation} from '@react-navigation/native'; -import Mapbox, {MapState, MarkerView, setAccessToken} from '@rnmapbox/maps'; +import type {MapState} from '@rnmapbox/maps'; +import Mapbox, {MarkerView, setAccessToken} from '@rnmapbox/maps'; import {forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; @@ -12,10 +13,10 @@ import useLocalize from '@src/hooks/useLocalize'; import useNetwork from '@src/hooks/useNetwork'; import ONYXKEYS from '@src/ONYXKEYS'; import Direction from './Direction'; -import {MapViewHandle} from './MapViewTypes'; +import type {MapViewHandle} from './MapViewTypes'; import PendingMapView from './PendingMapView'; import responder from './responder'; -import {ComponentProps, MapViewOnyxProps} from './types'; +import type {ComponentProps, MapViewOnyxProps} from './types'; import utils from './utils'; const MapView = forwardRef( diff --git a/src/components/MapView/MapView.website.tsx b/src/components/MapView/MapView.website.tsx index 82909001fefd..05d86e8ec999 100644 --- a/src/components/MapView/MapView.website.tsx +++ b/src/components/MapView/MapView.website.tsx @@ -6,7 +6,8 @@ import {useFocusEffect} from '@react-navigation/native'; import mapboxgl from 'mapbox-gl'; import 'mapbox-gl/dist/mapbox-gl.css'; import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState} from 'react'; -import Map, {MapRef, Marker} from 'react-map-gl'; +import type {MapRef} from 'react-map-gl'; +import Map, {Marker} from 'react-map-gl'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import useStyleUtils from '@hooks/useStyleUtils'; @@ -20,10 +21,10 @@ import getCurrentPosition from '@src/libs/getCurrentPosition'; import ONYXKEYS from '@src/ONYXKEYS'; import Direction from './Direction'; import './mapbox.css'; -import {MapViewHandle} from './MapViewTypes'; +import type {MapViewHandle} from './MapViewTypes'; import PendingMapView from './PendingMapView'; import responder from './responder'; -import {ComponentProps, MapViewOnyxProps} from './types'; +import type {ComponentProps, MapViewOnyxProps} from './types'; import utils from './utils'; const MapView = forwardRef( diff --git a/src/components/MapView/MapViewTypes.ts b/src/components/MapView/MapViewTypes.ts index 6cc52ac91d18..4b9ab6af233b 100644 --- a/src/components/MapView/MapViewTypes.ts +++ b/src/components/MapView/MapViewTypes.ts @@ -1,4 +1,4 @@ -import {ComponentType} from 'react'; +import type {ComponentType} from 'react'; import type {StyleProp, ViewStyle} from 'react-native'; type MapViewProps = { diff --git a/src/components/MapView/PendingMapView.tsx b/src/components/MapView/PendingMapView.tsx index 0af816785e9a..32bf42a14b10 100644 --- a/src/components/MapView/PendingMapView.tsx +++ b/src/components/MapView/PendingMapView.tsx @@ -6,7 +6,7 @@ import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; -import {PendingMapViewProps} from './MapViewTypes'; +import type {PendingMapViewProps} from './MapViewTypes'; function PendingMapView({title = '', subtitle = '', style}: PendingMapViewProps) { const hasTextContent = !_.isEmpty(title) || !_.isEmpty(subtitle); diff --git a/src/components/MapView/types.ts b/src/components/MapView/types.ts index 2c8b9240c445..a0494a9ac499 100644 --- a/src/components/MapView/types.ts +++ b/src/components/MapView/types.ts @@ -1,6 +1,6 @@ -import {OnyxEntry} from 'react-native-onyx'; -import * as OnyxTypes from '@src/types/onyx'; -import {MapViewProps} from './MapViewTypes'; +import type {OnyxEntry} from 'react-native-onyx'; +import type * as OnyxTypes from '@src/types/onyx'; +import type {MapViewProps} from './MapViewTypes'; type MapViewOnyxProps = { userLocation: OnyxEntry; diff --git a/src/components/MentionSuggestions.tsx b/src/components/MentionSuggestions.tsx index 3e235a2fc88a..459131ecc434 100644 --- a/src/components/MentionSuggestions.tsx +++ b/src/components/MentionSuggestions.tsx @@ -5,7 +5,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import getStyledTextArray from '@libs/GetStyledTextArray'; import CONST from '@src/CONST'; -import {Icon} from '@src/types/onyx/OnyxCommon'; +import type {Icon} from '@src/types/onyx/OnyxCommon'; import AutoCompleteSuggestions from './AutoCompleteSuggestions'; import Avatar from './Avatar'; import Text from './Text'; diff --git a/src/components/MenuItem.tsx b/src/components/MenuItem.tsx index 9faabc403c75..14dfd0e8dbc4 100644 --- a/src/components/MenuItem.tsx +++ b/src/components/MenuItem.tsx @@ -1,9 +1,11 @@ import ExpensiMark from 'expensify-common/lib/ExpensiMark'; -import {ImageContentFit} from 'expo-image'; -import React, {ForwardedRef, forwardRef, ReactNode, useEffect, useMemo, useRef, useState} from 'react'; -import {GestureResponderEvent, StyleProp, TextStyle, View, ViewStyle} from 'react-native'; -import {AnimatedStyle} from 'react-native-reanimated'; -import {ValueOf} from 'type-fest'; +import type {ImageContentFit} from 'expo-image'; +import type {ForwardedRef, ReactNode} from 'react'; +import React, {forwardRef, useEffect, useMemo, useRef, useState} from 'react'; +import type {GestureResponderEvent, StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {View} from 'react-native'; +import type {AnimatedStyle} from 'react-native-reanimated'; +import type {ValueOf} from 'type-fest'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -12,16 +14,16 @@ import ControlSelection from '@libs/ControlSelection'; import convertToLTR from '@libs/convertToLTR'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import getButtonState from '@libs/getButtonState'; -import {AvatarSource} from '@libs/UserUtils'; +import type {AvatarSource} from '@libs/UserUtils'; import variables from '@styles/variables'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; -import {Icon as IconType} from '@src/types/onyx/OnyxCommon'; -import IconAsset from '@src/types/utils/IconAsset'; +import type {Icon as IconType} from '@src/types/onyx/OnyxCommon'; +import type IconAsset from '@src/types/utils/IconAsset'; import Avatar from './Avatar'; import Badge from './Badge'; import DisplayNames from './DisplayNames'; -import {DisplayNameWithTooltip} from './DisplayNames/types'; +import type {DisplayNameWithTooltip} from './DisplayNames/types'; import FormHelpMessage from './FormHelpMessage'; import Hoverable from './Hoverable'; import Icon from './Icon'; diff --git a/src/components/MenuItemWithTopDescription.tsx b/src/components/MenuItemWithTopDescription.tsx index 48fa95ecf637..0a48740de62e 100644 --- a/src/components/MenuItemWithTopDescription.tsx +++ b/src/components/MenuItemWithTopDescription.tsx @@ -1,5 +1,6 @@ -import React, {ForwardedRef, forwardRef} from 'react'; -import {View} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef} from 'react'; +import type {View} from 'react-native'; import MenuItem from './MenuItem'; import type {MenuItemProps} from './MenuItem'; diff --git a/src/components/MessagesRow.tsx b/src/components/MessagesRow.tsx index f49a0927de06..cfec6fd292e9 100644 --- a/src/components/MessagesRow.tsx +++ b/src/components/MessagesRow.tsx @@ -1,9 +1,10 @@ import React from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as Localize from '@libs/Localize'; +import type * as Localize from '@libs/Localize'; import CONST from '@src/CONST'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import DotIndicatorMessage from './DotIndicatorMessage'; diff --git a/src/components/Modal/BaseModal.tsx b/src/components/Modal/BaseModal.tsx index e03c32f6bfcc..6e5b4eddae9e 100644 --- a/src/components/Modal/BaseModal.tsx +++ b/src/components/Modal/BaseModal.tsx @@ -13,7 +13,7 @@ import useNativeDriver from '@libs/useNativeDriver'; import variables from '@styles/variables'; import * as Modal from '@userActions/Modal'; import CONST from '@src/CONST'; -import BaseModalProps from './types'; +import type BaseModalProps from './types'; function BaseModal( { diff --git a/src/components/Modal/index.android.tsx b/src/components/Modal/index.android.tsx index 2343cb4c70a9..4d7ae128a114 100644 --- a/src/components/Modal/index.android.tsx +++ b/src/components/Modal/index.android.tsx @@ -3,7 +3,7 @@ import {AppState} from 'react-native'; import withWindowDimensions from '@components/withWindowDimensions'; import ComposerFocusManager from '@libs/ComposerFocusManager'; import BaseModal from './BaseModal'; -import BaseModalProps from './types'; +import type BaseModalProps from './types'; AppState.addEventListener('focus', () => { ComposerFocusManager.setReadyToFocus(); diff --git a/src/components/Modal/index.ios.tsx b/src/components/Modal/index.ios.tsx index f780775ec216..cbe58a071d7d 100644 --- a/src/components/Modal/index.ios.tsx +++ b/src/components/Modal/index.ios.tsx @@ -1,7 +1,7 @@ import React from 'react'; import withWindowDimensions from '@components/withWindowDimensions'; import BaseModal from './BaseModal'; -import BaseModalProps from './types'; +import type BaseModalProps from './types'; function Modal({children, ...rest}: BaseModalProps) { return ( diff --git a/src/components/Modal/index.tsx b/src/components/Modal/index.tsx index 4269420dcd7f..56f3c76a8879 100644 --- a/src/components/Modal/index.tsx +++ b/src/components/Modal/index.tsx @@ -5,7 +5,7 @@ import useTheme from '@hooks/useTheme'; import StatusBar from '@libs/StatusBar'; import CONST from '@src/CONST'; import BaseModal from './BaseModal'; -import BaseModalProps from './types'; +import type BaseModalProps from './types'; function Modal({fullscreen = true, onModalHide = () => {}, type, onModalShow = () => {}, children, ...rest}: BaseModalProps) { const theme = useTheme(); diff --git a/src/components/Modal/types.ts b/src/components/Modal/types.ts index 461a5935eda9..0fed37ffea8b 100644 --- a/src/components/Modal/types.ts +++ b/src/components/Modal/types.ts @@ -1,8 +1,8 @@ -import {ViewStyle} from 'react-native'; -import {ModalProps} from 'react-native-modal'; -import {ValueOf} from 'type-fest'; -import {WindowDimensionsProps} from '@components/withWindowDimensions/types'; -import CONST from '@src/CONST'; +import type {ViewStyle} from 'react-native'; +import type {ModalProps} from 'react-native-modal'; +import type {ValueOf} from 'type-fest'; +import type {WindowDimensionsProps} from '@components/withWindowDimensions/types'; +import type CONST from '@src/CONST'; type PopoverAnchorPosition = { top?: number; diff --git a/src/components/MoneyReportHeaderStatusBar.tsx b/src/components/MoneyReportHeaderStatusBar.tsx index 9d96d93423c5..4b30276a204f 100644 --- a/src/components/MoneyReportHeaderStatusBar.tsx +++ b/src/components/MoneyReportHeaderStatusBar.tsx @@ -4,7 +4,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as NextStepUtils from '@libs/NextStepUtils'; import CONST from '@src/CONST'; -import ReportNextStep from '@src/types/onyx/ReportNextStep'; +import type ReportNextStep from '@src/types/onyx/ReportNextStep'; import RenderHTML from './RenderHTML'; type MoneyReportHeaderStatusBarProps = { diff --git a/src/components/MultipleAvatars.tsx b/src/components/MultipleAvatars.tsx index 50807cce374a..a6f34cd459fc 100644 --- a/src/components/MultipleAvatars.tsx +++ b/src/components/MultipleAvatars.tsx @@ -1,10 +1,11 @@ import React, {memo, useMemo} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; -import {ValueOf} from 'type-fest'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; +import type {ValueOf} from 'type-fest'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import {AvatarSource} from '@libs/UserUtils'; +import type {AvatarSource} from '@libs/UserUtils'; import variables from '@styles/variables'; import CONST from '@src/CONST'; import type {Icon} from '@src/types/onyx/OnyxCommon'; diff --git a/src/components/OfflineIndicator.tsx b/src/components/OfflineIndicator.tsx index 035058ab9be9..1a61b6622783 100644 --- a/src/components/OfflineIndicator.tsx +++ b/src/components/OfflineIndicator.tsx @@ -1,5 +1,6 @@ import React, {useMemo} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useTheme from '@hooks/useTheme'; diff --git a/src/components/OfflineWithFeedback.tsx b/src/components/OfflineWithFeedback.tsx index 29fd0c2700dc..fa0ae5162346 100644 --- a/src/components/OfflineWithFeedback.tsx +++ b/src/components/OfflineWithFeedback.tsx @@ -1,12 +1,13 @@ import React, {useCallback} from 'react'; -import {ImageStyle, StyleProp, TextStyle, View, ViewStyle} from 'react-native'; +import type {ImageStyle, StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useNetwork from '@hooks/useNetwork'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import shouldRenderOffscreen from '@libs/shouldRenderOffscreen'; import CONST from '@src/CONST'; -import * as OnyxCommon from '@src/types/onyx/OnyxCommon'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type * as OnyxCommon from '@src/types/onyx/OnyxCommon'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; import {isNotEmptyObject} from '@src/types/utils/EmptyObject'; import MessagesRow from './MessagesRow'; diff --git a/src/components/OpacityView.tsx b/src/components/OpacityView.tsx index 6f82658bcac1..41ab148bd7f2 100644 --- a/src/components/OpacityView.tsx +++ b/src/components/OpacityView.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import {StyleProp, ViewStyle} from 'react-native'; -import Animated, {AnimatedStyle, useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated'; +import type {StyleProp, ViewStyle} from 'react-native'; +import type {AnimatedStyle} from 'react-native-reanimated'; +import Animated, {useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated'; import shouldRenderOffscreen from '@libs/shouldRenderOffscreen'; import variables from '@styles/variables'; diff --git a/src/components/OptionRow.tsx b/src/components/OptionRow.tsx index 5a2f6902c4c0..79b72b378e46 100644 --- a/src/components/OptionRow.tsx +++ b/src/components/OptionRow.tsx @@ -1,6 +1,7 @@ import lodashIsEqual from 'lodash/isEqual'; import React, {useEffect, useRef, useState} from 'react'; -import {InteractionManager, StyleProp, StyleSheet, TextStyle, View, ViewStyle} from 'react-native'; +import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {InteractionManager, StyleSheet, View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; diff --git a/src/components/ParentNavigationSubtitle.tsx b/src/components/ParentNavigationSubtitle.tsx index b3f1653fda1a..2816715dae2c 100644 --- a/src/components/ParentNavigationSubtitle.tsx +++ b/src/components/ParentNavigationSubtitle.tsx @@ -1,10 +1,10 @@ import React from 'react'; -import {StyleProp, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import CONST from '@src/CONST'; -import {ParentNavigationSummaryParams} from '@src/languages/types'; +import type {ParentNavigationSummaryParams} from '@src/languages/types'; import ROUTES from '@src/ROUTES'; import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; import Text from './Text'; diff --git a/src/components/Picker/BasePicker.tsx b/src/components/Picker/BasePicker.tsx index edaab2693e7b..678bb6f06403 100644 --- a/src/components/Picker/BasePicker.tsx +++ b/src/components/Picker/BasePicker.tsx @@ -1,6 +1,8 @@ import lodashDefer from 'lodash/defer'; -import React, {ForwardedRef, forwardRef, ReactElement, ReactNode, RefObject, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'; -import {ScrollView, View} from 'react-native'; +import type {ForwardedRef, ReactElement, ReactNode, RefObject} from 'react'; +import React, {forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'; +import type {ScrollView} from 'react-native'; +import {View} from 'react-native'; import RNPickerSelect from 'react-native-picker-select'; import FormHelpMessage from '@components/FormHelpMessage'; import Icon from '@components/Icon'; diff --git a/src/components/Picker/index.native.tsx b/src/components/Picker/index.native.tsx index 7373f5a6f280..67968096f9f6 100644 --- a/src/components/Picker/index.native.tsx +++ b/src/components/Picker/index.native.tsx @@ -1,6 +1,7 @@ -import React, {ForwardedRef, forwardRef} from 'react'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef} from 'react'; import BasePicker from './BasePicker'; -import {BasePickerHandle, BasePickerProps} from './types'; +import type {BasePickerHandle, BasePickerProps} from './types'; function Picker(props: BasePickerProps, ref: ForwardedRef) { return ( diff --git a/src/components/Picker/index.tsx b/src/components/Picker/index.tsx index 18184b130bba..591914b74d4c 100644 --- a/src/components/Picker/index.tsx +++ b/src/components/Picker/index.tsx @@ -1,4 +1,5 @@ -import React, {ForwardedRef, forwardRef} from 'react'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef} from 'react'; import BasePicker from './BasePicker'; import type {AdditionalPickerEvents, BasePickerHandle, BasePickerProps, OnChange, OnMouseDown} from './types'; diff --git a/src/components/Picker/types.ts b/src/components/Picker/types.ts index 58eed0371893..edf39a59c9d8 100644 --- a/src/components/Picker/types.ts +++ b/src/components/Picker/types.ts @@ -1,5 +1,5 @@ -import {ChangeEvent, Component, ReactElement} from 'react'; -import {MeasureLayoutOnSuccessCallback, NativeMethods, StyleProp, ViewStyle} from 'react-native'; +import type {ChangeEvent, Component, ReactElement} from 'react'; +import type {MeasureLayoutOnSuccessCallback, NativeMethods, StyleProp, ViewStyle} from 'react-native'; type MeasureLayoutOnFailCallback = () => void; diff --git a/src/components/PlaidLink/index.native.tsx b/src/components/PlaidLink/index.native.tsx index c46a9df2076e..24ab75eb62b7 100644 --- a/src/components/PlaidLink/index.native.tsx +++ b/src/components/PlaidLink/index.native.tsx @@ -1,8 +1,9 @@ import {useEffect} from 'react'; -import {dismissLink, LinkEvent, openLink, usePlaidEmitter} from 'react-native-plaid-link-sdk'; +import type {LinkEvent} from 'react-native-plaid-link-sdk'; +import {dismissLink, openLink, usePlaidEmitter} from 'react-native-plaid-link-sdk'; import Log from '@libs/Log'; import CONST from '@src/CONST'; -import PlaidLinkProps from './types'; +import type PlaidLinkProps from './types'; function PlaidLink({token, onSuccess = () => {}, onExit = () => {}, onEvent}: PlaidLinkProps) { usePlaidEmitter((event: LinkEvent) => { diff --git a/src/components/PlaidLink/index.tsx b/src/components/PlaidLink/index.tsx index 08655458d12e..c3a913886f2c 100644 --- a/src/components/PlaidLink/index.tsx +++ b/src/components/PlaidLink/index.tsx @@ -1,10 +1,11 @@ import React, {useCallback, useEffect, useState} from 'react'; import {ActivityIndicator, View} from 'react-native'; -import {PlaidLinkOnSuccessMetadata, usePlaidLink} from 'react-plaid-link'; +import type {PlaidLinkOnSuccessMetadata} from 'react-plaid-link'; +import {usePlaidLink} from 'react-plaid-link'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import Log from '@libs/Log'; -import PlaidLinkProps from './types'; +import type PlaidLinkProps from './types'; function PlaidLink({token, onSuccess = () => {}, onError = () => {}, onExit = () => {}, onEvent, receivedRedirectURI}: PlaidLinkProps) { const [isPlaidLoaded, setIsPlaidLoaded] = useState(false); diff --git a/src/components/PlaidLink/types.ts b/src/components/PlaidLink/types.ts index 1034eb935f74..48526520c736 100644 --- a/src/components/PlaidLink/types.ts +++ b/src/components/PlaidLink/types.ts @@ -1,5 +1,5 @@ -import {LinkEventMetadata, LinkSuccessMetadata} from 'react-native-plaid-link-sdk'; -import {PlaidLinkOnEventMetadata, PlaidLinkOnSuccessMetadata} from 'react-plaid-link'; +import type {LinkEventMetadata, LinkSuccessMetadata} from 'react-native-plaid-link-sdk'; +import type {PlaidLinkOnEventMetadata, PlaidLinkOnSuccessMetadata} from 'react-plaid-link'; type PlaidLinkProps = { // Plaid Link SDK public token used to initialize the Plaid SDK diff --git a/src/components/Popover/index.native.tsx b/src/components/Popover/index.native.tsx index 3fff04d00d2f..08ed15fd0d30 100644 --- a/src/components/Popover/index.native.tsx +++ b/src/components/Popover/index.native.tsx @@ -1,7 +1,7 @@ import React from 'react'; import Modal from '@components/Modal'; import CONST from '@src/CONST'; -import {PopoverProps} from './types'; +import type {PopoverProps} from './types'; /* * This is a convenience wrapper around the Modal component for a responsive Popover. diff --git a/src/components/Popover/index.tsx b/src/components/Popover/index.tsx index bf79415d4794..762e79fab63c 100644 --- a/src/components/Popover/index.tsx +++ b/src/components/Popover/index.tsx @@ -5,7 +5,7 @@ import {PopoverContext} from '@components/PopoverProvider'; import PopoverWithoutOverlay from '@components/PopoverWithoutOverlay'; import withWindowDimensions from '@components/withWindowDimensions'; import CONST from '@src/CONST'; -import {PopoverWithWindowDimensionsProps} from './types'; +import type {PopoverWithWindowDimensionsProps} from './types'; /* * This is a convenience wrapper around the Modal component for a responsive Popover. diff --git a/src/components/Popover/types.ts b/src/components/Popover/types.ts index 7890ce5555f0..3d1f95822e6a 100644 --- a/src/components/Popover/types.ts +++ b/src/components/Popover/types.ts @@ -1,7 +1,8 @@ import type {ValueOf} from 'type-fest'; -import BaseModalProps, {PopoverAnchorPosition} from '@components/Modal/types'; -import {WindowDimensionsProps} from '@components/withWindowDimensions/types'; -import CONST from '@src/CONST'; +import type {PopoverAnchorPosition} from '@components/Modal/types'; +import type BaseModalProps from '@components/Modal/types'; +import type {WindowDimensionsProps} from '@components/withWindowDimensions/types'; +import type CONST from '@src/CONST'; type AnchorAlignment = { /** The horizontal anchor alignment of the popover */ diff --git a/src/components/PopoverMenu.tsx b/src/components/PopoverMenu.tsx index 2c85b80534ca..502bdbf83b53 100644 --- a/src/components/PopoverMenu.tsx +++ b/src/components/PopoverMenu.tsx @@ -1,5 +1,6 @@ import type {ImageContentFit} from 'expo-image'; -import React, {RefObject, useRef} from 'react'; +import type {RefObject} from 'react'; +import React, {useRef} from 'react'; import {View} from 'react-native'; import type {ModalProps} from 'react-native-modal'; import type {SvgProps} from 'react-native-svg'; diff --git a/src/components/PopoverProvider/index.native.tsx b/src/components/PopoverProvider/index.native.tsx index a87036c61808..b13909945bef 100644 --- a/src/components/PopoverProvider/index.native.tsx +++ b/src/components/PopoverProvider/index.native.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import {PopoverContextProps, PopoverContextValue} from './types'; +import type {PopoverContextProps, PopoverContextValue} from './types'; const PopoverContext = React.createContext({ onOpen: () => {}, diff --git a/src/components/PopoverProvider/index.tsx b/src/components/PopoverProvider/index.tsx index 06345ebdbc1c..b50b04289813 100644 --- a/src/components/PopoverProvider/index.tsx +++ b/src/components/PopoverProvider/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import {AnchorRef, PopoverContextProps, PopoverContextValue} from './types'; +import type {AnchorRef, PopoverContextProps, PopoverContextValue} from './types'; const PopoverContext = React.createContext({ onOpen: () => {}, diff --git a/src/components/PopoverWithMeasuredContent.tsx b/src/components/PopoverWithMeasuredContent.tsx index 206a33181605..792002441ac6 100644 --- a/src/components/PopoverWithMeasuredContent.tsx +++ b/src/components/PopoverWithMeasuredContent.tsx @@ -1,13 +1,14 @@ import isEqual from 'lodash/isEqual'; import React, {useMemo, useState} from 'react'; -import {LayoutChangeEvent, View} from 'react-native'; +import type {LayoutChangeEvent} from 'react-native'; +import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import PopoverWithMeasuredContentUtils from '@libs/PopoverWithMeasuredContentUtils'; import CONST from '@src/CONST'; import type {AnchorPosition} from '@src/styles'; import Popover from './Popover'; -import {PopoverProps} from './Popover/types'; +import type {PopoverProps} from './Popover/types'; import type {WindowDimensionsProps} from './withWindowDimensions/types'; type PopoverWithMeasuredContentProps = Omit & { @@ -35,6 +36,12 @@ function PopoverWithMeasuredContent({ }, children, withoutOverlay = false, + fullscreen = true, + shouldCloseOnOutsideClick = false, + shouldSetModalVisibility = true, + statusBarTranslucent = true, + avoidKeyboard = false, + hideModalContentWhileAnimating = false, ...props }: PopoverWithMeasuredContentProps) { const styles = useThemeStyles(); @@ -114,6 +121,12 @@ function PopoverWithMeasuredContent({ anchorAlignment={anchorAlignment} isVisible={isVisible} withoutOverlay={withoutOverlay} + fullscreen={fullscreen} + shouldCloseOnOutsideClick={shouldCloseOnOutsideClick} + shouldSetModalVisibility={shouldSetModalVisibility} + statusBarTranslucent={statusBarTranslucent} + avoidKeyboard={avoidKeyboard} + hideModalContentWhileAnimating={hideModalContentWhileAnimating} // eslint-disable-next-line react/jsx-props-no-spreading {...props} anchorPosition={shiftedAnchorPosition} diff --git a/src/components/PopoverWithoutOverlay/index.tsx b/src/components/PopoverWithoutOverlay/index.tsx index f83949bcbe9d..6aed275bd2dc 100644 --- a/src/components/PopoverWithoutOverlay/index.tsx +++ b/src/components/PopoverWithoutOverlay/index.tsx @@ -1,4 +1,5 @@ -import React, {ForwardedRef, forwardRef, useContext, useEffect, useMemo} from 'react'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef, useContext, useEffect, useMemo} from 'react'; import {View} from 'react-native'; import ColorSchemeWrapper from '@components/ColorSchemeWrapper'; import {PopoverContext} from '@components/PopoverProvider'; @@ -7,7 +8,7 @@ import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as Modal from '@userActions/Modal'; -import PopoverWithoutOverlayProps from './types'; +import type PopoverWithoutOverlayProps from './types'; function PopoverWithoutOverlay( { diff --git a/src/components/PopoverWithoutOverlay/types.ts b/src/components/PopoverWithoutOverlay/types.ts index 0d70c4a5facb..ff4f73fd4114 100644 --- a/src/components/PopoverWithoutOverlay/types.ts +++ b/src/components/PopoverWithoutOverlay/types.ts @@ -1,6 +1,6 @@ -import {View} from 'react-native'; -import BaseModalProps from '@components/Modal/types'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {View} from 'react-native'; +import type BaseModalProps from '@components/Modal/types'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type PopoverWithoutOverlayProps = ChildrenProps & Omit & { diff --git a/src/components/Pressable/GenericPressable/BaseGenericPressable.tsx b/src/components/Pressable/GenericPressable/BaseGenericPressable.tsx index 0a9f544bcee1..f41a6b389001 100644 --- a/src/components/Pressable/GenericPressable/BaseGenericPressable.tsx +++ b/src/components/Pressable/GenericPressable/BaseGenericPressable.tsx @@ -1,6 +1,8 @@ -import React, {ForwardedRef, forwardRef, useCallback, useEffect, useMemo} from 'react'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef, useCallback, useEffect, useMemo} from 'react'; +import type {GestureResponderEvent, View} from 'react-native'; // eslint-disable-next-line no-restricted-imports -import {GestureResponderEvent, Pressable, View} from 'react-native'; +import {Pressable} from 'react-native'; import useSingleExecution from '@hooks/useSingleExecution'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -8,7 +10,8 @@ import Accessibility from '@libs/Accessibility'; import HapticFeedback from '@libs/HapticFeedback'; import KeyboardShortcut from '@libs/KeyboardShortcut'; import CONST from '@src/CONST'; -import PressableProps, {PressableRef} from './types'; +import type {PressableRef} from './types'; +import type PressableProps from './types'; function GenericPressable( { diff --git a/src/components/Pressable/GenericPressable/index.native.tsx b/src/components/Pressable/GenericPressable/index.native.tsx index 968ee6063a95..c17163677cbe 100644 --- a/src/components/Pressable/GenericPressable/index.native.tsx +++ b/src/components/Pressable/GenericPressable/index.native.tsx @@ -1,6 +1,7 @@ import React, {forwardRef} from 'react'; import GenericPressable from './BaseGenericPressable'; -import PressableProps, {PressableRef} from './types'; +import type {PressableRef} from './types'; +import type PressableProps from './types'; function NativeGenericPressable(props: PressableProps, ref: PressableRef) { return ( diff --git a/src/components/Pressable/GenericPressable/index.tsx b/src/components/Pressable/GenericPressable/index.tsx index 51099733e04f..3d6301379155 100644 --- a/src/components/Pressable/GenericPressable/index.tsx +++ b/src/components/Pressable/GenericPressable/index.tsx @@ -1,7 +1,8 @@ import React, {forwardRef} from 'react'; -import {Role} from 'react-native'; +import type {Role} from 'react-native'; import GenericPressable from './BaseGenericPressable'; -import PressableProps, {PressableRef} from './types'; +import type {PressableRef} from './types'; +import type PressableProps from './types'; function WebGenericPressable({focusable = true, ...props}: PressableProps, ref: PressableRef) { const accessible = props.accessible ?? props.accessible === undefined ? true : props.accessible; diff --git a/src/components/Pressable/GenericPressable/types.ts b/src/components/Pressable/GenericPressable/types.ts index cdb9a8624114..dc04b6fcf329 100644 --- a/src/components/Pressable/GenericPressable/types.ts +++ b/src/components/Pressable/GenericPressable/types.ts @@ -1,8 +1,8 @@ -import {ElementRef, ForwardedRef, RefObject} from 'react'; -import {GestureResponderEvent, HostComponent, PressableStateCallbackType, PressableProps as RNPressableProps, StyleProp, View, ViewStyle} from 'react-native'; -import {ValueOf} from 'type-fest'; -import {Shortcut} from '@libs/KeyboardShortcut'; -import CONST from '@src/CONST'; +import type {ElementRef, ForwardedRef, RefObject} from 'react'; +import type {GestureResponderEvent, HostComponent, PressableStateCallbackType, PressableProps as RNPressableProps, StyleProp, View, ViewStyle} from 'react-native'; +import type {ValueOf} from 'type-fest'; +import type {Shortcut} from '@libs/KeyboardShortcut'; +import type CONST from '@src/CONST'; type StylePropWithFunction = StyleProp | ((state: PressableStateCallbackType) => StyleProp); diff --git a/src/components/Pressable/PressableWithDelayToggle.tsx b/src/components/Pressable/PressableWithDelayToggle.tsx index d265be929b0c..ab1fa95efeb5 100644 --- a/src/components/Pressable/PressableWithDelayToggle.tsx +++ b/src/components/Pressable/PressableWithDelayToggle.tsx @@ -1,6 +1,6 @@ /* eslint-disable react-native-a11y/has-valid-accessibility-descriptors */ import React, {forwardRef} from 'react'; -import {StyleProp, TextStyle, ViewStyle} from 'react-native'; +import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import Text from '@components/Text'; @@ -10,8 +10,9 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useThrottledButtonState from '@hooks/useThrottledButtonState'; import getButtonState from '@libs/getButtonState'; import variables from '@styles/variables'; -import IconAsset from '@src/types/utils/IconAsset'; -import PressableProps, {PressableRef} from './GenericPressable/types'; +import type IconAsset from '@src/types/utils/IconAsset'; +import type {PressableRef} from './GenericPressable/types'; +import type PressableProps from './GenericPressable/types'; import PressableWithoutFeedback from './PressableWithoutFeedback'; type PressableWithDelayToggleProps = PressableProps & { diff --git a/src/components/Pressable/PressableWithFeedback.tsx b/src/components/Pressable/PressableWithFeedback.tsx index a4c439c4441c..b717c4890a2d 100644 --- a/src/components/Pressable/PressableWithFeedback.tsx +++ b/src/components/Pressable/PressableWithFeedback.tsx @@ -1,10 +1,11 @@ import React, {forwardRef, useState} from 'react'; -import {StyleProp, ViewStyle} from 'react-native'; -import {AnimatedStyle} from 'react-native-reanimated'; +import type {StyleProp, ViewStyle} from 'react-native'; +import type {AnimatedStyle} from 'react-native-reanimated'; import OpacityView from '@components/OpacityView'; import variables from '@styles/variables'; import GenericPressable from './GenericPressable'; -import PressableProps, {PressableRef} from './GenericPressable/types'; +import type {PressableRef} from './GenericPressable/types'; +import type PressableProps from './GenericPressable/types'; type PressableWithFeedbackProps = PressableProps & { /** Style for the wrapper view */ diff --git a/src/components/Pressable/PressableWithoutFeedback.tsx b/src/components/Pressable/PressableWithoutFeedback.tsx index fd9d695cc2ed..f95050dd649e 100644 --- a/src/components/Pressable/PressableWithoutFeedback.tsx +++ b/src/components/Pressable/PressableWithoutFeedback.tsx @@ -1,6 +1,7 @@ import React from 'react'; import GenericPressable from './GenericPressable'; -import PressableProps, {PressableRef} from './GenericPressable/types'; +import type {PressableRef} from './GenericPressable/types'; +import type PressableProps from './GenericPressable/types'; function PressableWithoutFeedback( {pressStyle, hoverStyle, focusStyle, disabledStyle, screenReaderActiveStyle, shouldUseHapticsOnPress, shouldUseHapticsOnLongPress, ...rest}: PressableProps, diff --git a/src/components/Pressable/PressableWithoutFocus.tsx b/src/components/Pressable/PressableWithoutFocus.tsx index 32cb1708baf0..f887b0ea9b7d 100644 --- a/src/components/Pressable/PressableWithoutFocus.tsx +++ b/src/components/Pressable/PressableWithoutFocus.tsx @@ -1,7 +1,7 @@ import React, {useRef} from 'react'; -import {View} from 'react-native'; +import type {View} from 'react-native'; import GenericPressable from './GenericPressable'; -import PressableProps from './GenericPressable/types'; +import type PressableProps from './GenericPressable/types'; /** * This component prevents the tapped element from capturing focus. diff --git a/src/components/PressableWithSecondaryInteraction/index.native.tsx b/src/components/PressableWithSecondaryInteraction/index.native.tsx index 77dc9452f986..d448e6d6ecc3 100644 --- a/src/components/PressableWithSecondaryInteraction/index.native.tsx +++ b/src/components/PressableWithSecondaryInteraction/index.native.tsx @@ -1,9 +1,10 @@ -import React, {forwardRef, ReactNode} from 'react'; -import {GestureResponderEvent, TextProps} from 'react-native'; -import {PressableRef} from '@components/Pressable/GenericPressable/types'; +import type {ReactNode} from 'react'; +import React, {forwardRef} from 'react'; +import type {GestureResponderEvent, TextProps} from 'react-native'; +import type {PressableRef} from '@components/Pressable/GenericPressable/types'; import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; import Text from '@components/Text'; -import PressableWithSecondaryInteractionProps from './types'; +import type PressableWithSecondaryInteractionProps from './types'; /** This is a special Pressable that calls onSecondaryInteraction when LongPressed. */ function PressableWithSecondaryInteraction( diff --git a/src/components/PressableWithSecondaryInteraction/index.tsx b/src/components/PressableWithSecondaryInteraction/index.tsx index 0cb53e40325a..5e2de765f733 100644 --- a/src/components/PressableWithSecondaryInteraction/index.tsx +++ b/src/components/PressableWithSecondaryInteraction/index.tsx @@ -1,11 +1,11 @@ import React, {forwardRef, useEffect, useRef} from 'react'; -import {GestureResponderEvent} from 'react-native'; -import {PressableRef} from '@components/Pressable/GenericPressable/types'; +import type {GestureResponderEvent} from 'react-native'; +import type {PressableRef} from '@components/Pressable/GenericPressable/types'; import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; -import PressableWithSecondaryInteractionProps from './types'; +import type PressableWithSecondaryInteractionProps from './types'; /** This is a special Pressable that calls onSecondaryInteraction when LongPressed, or right-clicked. */ function PressableWithSecondaryInteraction( diff --git a/src/components/PressableWithSecondaryInteraction/types.ts b/src/components/PressableWithSecondaryInteraction/types.ts index bf999e9692b5..aa67d45d66fb 100644 --- a/src/components/PressableWithSecondaryInteraction/types.ts +++ b/src/components/PressableWithSecondaryInteraction/types.ts @@ -1,5 +1,5 @@ import type {GestureResponderEvent} from 'react-native'; -import {PressableWithFeedbackProps} from '@components/Pressable/PressableWithFeedback'; +import type {PressableWithFeedbackProps} from '@components/Pressable/PressableWithFeedback'; import type {ParsableStyle} from '@styles/utils/types'; type PressableWithSecondaryInteractionProps = PressableWithFeedbackProps & { diff --git a/src/components/QRCode.tsx b/src/components/QRCode.tsx index 99a3a1f64118..89c367bab222 100644 --- a/src/components/QRCode.tsx +++ b/src/components/QRCode.tsx @@ -1,5 +1,6 @@ -import React, {Ref} from 'react'; -import {ImageSourcePropType} from 'react-native'; +import type {Ref} from 'react'; +import React from 'react'; +import type {ImageSourcePropType} from 'react-native'; import QRCodeLibrary from 'react-native-qrcode-svg'; import useTheme from '@hooks/useTheme'; import CONST from '@src/CONST'; diff --git a/src/components/RNTextInput.tsx b/src/components/RNTextInput.tsx index 40dfc109ba6b..f7917a852704 100644 --- a/src/components/RNTextInput.tsx +++ b/src/components/RNTextInput.tsx @@ -1,7 +1,10 @@ -import React, {Component, ForwardedRef} from 'react'; +import type {Component, ForwardedRef} from 'react'; +import React from 'react'; // eslint-disable-next-line no-restricted-imports -import {TextInput, TextInputProps} from 'react-native'; -import Animated, {AnimatedProps} from 'react-native-reanimated'; +import type {TextInputProps} from 'react-native'; +import {TextInput} from 'react-native'; +import type {AnimatedProps} from 'react-native-reanimated'; +import Animated from 'react-native-reanimated'; import useTheme from '@hooks/useTheme'; type AnimatedTextInputRef = Component>; diff --git a/src/components/RadioButtonWithLabel.tsx b/src/components/RadioButtonWithLabel.tsx index 4c223262ac50..f4bad4c082a7 100644 --- a/src/components/RadioButtonWithLabel.tsx +++ b/src/components/RadioButtonWithLabel.tsx @@ -1,5 +1,7 @@ -import React, {ComponentType} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {ComponentType} from 'react'; +import React from 'react'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import FormHelpMessage from './FormHelpMessage'; import * as Pressables from './Pressable'; diff --git a/src/components/ReportActionItem/MoneyReportView.tsx b/src/components/ReportActionItem/MoneyReportView.tsx index 36daa037fd78..16ea27b17f42 100644 --- a/src/components/ReportActionItem/MoneyReportView.tsx +++ b/src/components/ReportActionItem/MoneyReportView.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {StyleProp, TextStyle, View} from 'react-native'; +import type {StyleProp, TextStyle} from 'react-native'; +import {View} from 'react-native'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import SpacerView from '@components/SpacerView'; diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js index 514dc71ffe2c..3437058efa45 100644 --- a/src/components/ReportActionItem/MoneyRequestView.js +++ b/src/components/ReportActionItem/MoneyRequestView.js @@ -1,7 +1,7 @@ import lodashGet from 'lodash/get'; import lodashValues from 'lodash/values'; import PropTypes from 'prop-types'; -import React, {useMemo} from 'react'; +import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import categoryPropTypes from '@components/categoryPropTypes'; @@ -14,12 +14,14 @@ import Switch from '@components/Switch'; import tagPropTypes from '@components/tagPropTypes'; import Text from '@components/Text'; import transactionPropTypes from '@components/transactionPropTypes'; +import ViolationMessages from '@components/ViolationMessages'; import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes} from '@components/withCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import usePermissions from '@hooks/usePermissions'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import useViolations from '@hooks/useViolations'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as CardUtils from '@libs/CardUtils'; import compose from '@libs/compose'; @@ -41,6 +43,32 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import ReportActionItemImage from './ReportActionItemImage'; +const violationNames = lodashValues(CONST.VIOLATIONS); + +const transactionViolationPropType = PropTypes.shape({ + type: PropTypes.string.isRequired, + name: PropTypes.oneOf(violationNames).isRequired, + data: PropTypes.shape({ + rejectedBy: PropTypes.string, + rejectReason: PropTypes.string, + amount: PropTypes.string, + surcharge: PropTypes.number, + invoiceMarkup: PropTypes.number, + maxAge: PropTypes.number, + tagName: PropTypes.string, + formattedLimitAmount: PropTypes.string, + categoryLimit: PropTypes.string, + limit: PropTypes.string, + category: PropTypes.string, + brokenBankConnection: PropTypes.bool, + isAdmin: PropTypes.bool, + email: PropTypes.string, + isTransactionOlderThan7Days: PropTypes.bool, + member: PropTypes.string, + taxName: PropTypes.string, + }), +}); + const propTypes = { /** The report currently being looked at */ report: reportPropTypes.isRequired, @@ -61,6 +89,9 @@ const propTypes = { /** The transaction associated with the transactionThread */ transaction: transactionPropTypes, + /** Violations detected in this transaction */ + transactionViolations: PropTypes.arrayOf(transactionViolationPropType), + /** Collection of tags attached to a policy */ policyTags: tagPropTypes, @@ -76,10 +107,11 @@ const defaultProps = { currency: CONST.CURRENCY.USD, comment: {comment: ''}, }, + transactionViolations: [], policyTags: {}, }; -function MoneyRequestView({report, parentReport, parentReportActions, policyCategories, shouldShowHorizontalRule, transaction, policyTags, policy}) { +function MoneyRequestView({report, parentReport, parentReportActions, policyCategories, shouldShowHorizontalRule, transaction, policyTags, policy, transactionViolations}) { const theme = useTheme(); const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); @@ -116,7 +148,7 @@ function MoneyRequestView({report, parentReport, parentReportActions, policyCate const isSettled = ReportUtils.isSettled(moneyRequestReport.reportID); const isCancelled = moneyRequestReport && moneyRequestReport.isCancelledIOU; const canEdit = ReportUtils.canEditMoneyRequest(parentReportAction); - const canEditAmount = canEdit && !isSettled && !isCardTransaction; + const canEditAmount = ReportUtils.canEditMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.AMOUNT, transaction) && !isSettled && !isCardTransaction; const canEditReceipt = ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, moneyRequestReport.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT); // A flag for verifying that the current report is a sub-report of a workspace chat @@ -131,6 +163,9 @@ function MoneyRequestView({report, parentReport, parentReportActions, policyCate const shouldShowTag = isPolicyExpenseChat && (transactionTag || OptionsListUtils.hasEnabledOptions(lodashValues(policyTagsList))); const shouldShowBillable = isPolicyExpenseChat && (transactionBillable || !lodashGet(policy, 'disabledFields.defaultBillable', true)); + const {getViolationsForField} = useViolations(transactionViolations); + const hasViolations = useCallback((field) => canUseViolations && getViolationsForField(field).length > 0, [canUseViolations, getViolationsForField]); + let amountDescription = `${translate('iou.amount')}`; if (isCardTransaction) { @@ -198,6 +233,7 @@ function MoneyRequestView({report, parentReport, parentReportActions, policyCate onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT))} /> )} + {canUseViolations && } Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.AMOUNT))} - brickRoadIndicator={hasErrors && transactionAmount === 0 ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} + brickRoadIndicator={hasViolations('amount') || (hasErrors && transactionAmount === 0) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} error={hasErrors && transactionAmount === 0 ? translate('common.error.enterAmount') : ''} /> + {canUseViolations && } Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DESCRIPTION))} wrapperStyle={[styles.pv2, styles.taskDescriptionMenuItem]} + brickRoadIndicator={hasViolations('comment') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} numberOfLinesTitle={0} /> + {canUseViolations && } {isDistanceRequest ? ( @@ -245,9 +284,10 @@ function MoneyRequestView({report, parentReport, parentReportActions, policyCate shouldShowRightIcon={canEdit} titleStyle={styles.flex1} onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.MERCHANT))} - brickRoadIndicator={hasErrors && isEmptyMerchant ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} + brickRoadIndicator={hasViolations('merchant') || (hasErrors && isEmptyMerchant) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} error={hasErrors && isEmptyMerchant ? translate('common.error.enterMerchant') : ''} /> + {canUseViolations && } )} @@ -258,9 +298,10 @@ function MoneyRequestView({report, parentReport, parentReportActions, policyCate shouldShowRightIcon={canEdit && !isSettled} titleStyle={styles.flex1} onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DATE))} - brickRoadIndicator={hasErrors && transactionDate === '' ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} + brickRoadIndicator={hasViolations('date') || (hasErrors && transactionDate === '') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} error={hasErrors && transactionDate === '' ? translate('common.error.enterDate') : ''} /> + {canUseViolations && } {shouldShowCategory && ( @@ -271,7 +312,9 @@ function MoneyRequestView({report, parentReport, parentReportActions, policyCate shouldShowRightIcon={canEdit} titleStyle={styles.flex1} onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.CATEGORY))} + brickRoadIndicator={hasViolations('category') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} /> + {canUseViolations && } )} {shouldShowTag && ( @@ -283,7 +326,9 @@ function MoneyRequestView({report, parentReport, parentReportActions, policyCate shouldShowRightIcon={canEdit} titleStyle={styles.flex1} onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.TAG))} + brickRoadIndicator={hasViolations('tag') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} /> + {canUseViolations && } )} {isCardTransaction && ( @@ -295,15 +340,24 @@ function MoneyRequestView({report, parentReport, parentReportActions, policyCate /> )} + {shouldShowBillable && ( - - {translate('common.billable')} - IOU.editMoneyRequest(transaction, report.reportID, {billable: value})} - /> - + <> + + {translate('common.billable')} + IOU.editMoneyRequest(transaction, report.reportID, {billable: value})} + /> + + {hasViolations('billable') && ( + + )} + )} { + const parentReportAction = ReportActionsUtils.getParentReportAction(report); + const transactionID = lodashGet(parentReportAction, ['originalMessage', 'IOUTransactionID'], 0); + return `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`; + }, + }, + policyTags: { + key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${report.policyID}`, + }, }), )(MoneyRequestView); diff --git a/src/components/ReportActionItem/RenameAction.tsx b/src/components/ReportActionItem/RenameAction.tsx index ef9317ecac0e..b4b2553d652a 100644 --- a/src/components/ReportActionItem/RenameAction.tsx +++ b/src/components/ReportActionItem/RenameAction.tsx @@ -1,6 +1,7 @@ import React from 'react'; import Text from '@components/Text'; -import withCurrentUserPersonalDetails, {type WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails'; +import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; +import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 3fa3439fe86a..248f6894ca37 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -1,6 +1,7 @@ import React from 'react'; import {View} from 'react-native'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; diff --git a/src/components/SafeArea/index.ios.tsx b/src/components/SafeArea/index.ios.tsx index 1b2e1881ade3..2ef10a192a17 100644 --- a/src/components/SafeArea/index.ios.tsx +++ b/src/components/SafeArea/index.ios.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {SafeAreaView} from 'react-native-safe-area-context'; import useThemeStyles from '@hooks/useThemeStyles'; -import SafeAreaProps from './types'; +import type SafeAreaProps from './types'; function SafeArea({children}: SafeAreaProps) { const styles = useThemeStyles(); diff --git a/src/components/SafeArea/index.tsx b/src/components/SafeArea/index.tsx index 94090ef48642..5aa44c40e859 100644 --- a/src/components/SafeArea/index.tsx +++ b/src/components/SafeArea/index.tsx @@ -1,3 +1,3 @@ -import SafeAreaProps from './types'; +import type SafeAreaProps from './types'; export default ({children}: SafeAreaProps) => children; diff --git a/src/components/SafeArea/types.ts b/src/components/SafeArea/types.ts index 89faea46ab71..7cf53e13b72d 100644 --- a/src/components/SafeArea/types.ts +++ b/src/components/SafeArea/types.ts @@ -1,4 +1,4 @@ -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type SafeAreaProps = ChildrenProps; diff --git a/src/components/SafeAreaConsumer/index.android.tsx b/src/components/SafeAreaConsumer/index.android.tsx index 4e6c9bbd3528..f1523407805b 100644 --- a/src/components/SafeAreaConsumer/index.android.tsx +++ b/src/components/SafeAreaConsumer/index.android.tsx @@ -3,7 +3,7 @@ import React from 'react'; import {SafeAreaInsetsContext} from 'react-native-safe-area-context'; import useStyleUtils from '@hooks/useStyleUtils'; import StatusBar from '@libs/StatusBar'; -import SafeAreaConsumerProps from './types'; +import type SafeAreaConsumerProps from './types'; /** * This component is a light wrapper around the SafeAreaInsetsContext.Consumer. There are several places where we diff --git a/src/components/SafeAreaConsumer/index.tsx b/src/components/SafeAreaConsumer/index.tsx index c05e836a2348..926ff91258f9 100644 --- a/src/components/SafeAreaConsumer/index.tsx +++ b/src/components/SafeAreaConsumer/index.tsx @@ -2,7 +2,7 @@ import React from 'react'; // eslint-disable-next-line no-restricted-imports import {SafeAreaInsetsContext} from 'react-native-safe-area-context'; import useStyleUtils from '@hooks/useStyleUtils'; -import SafeAreaConsumerProps from './types'; +import type SafeAreaConsumerProps from './types'; /** * This component is a light wrapper around the SafeAreaInsetsContext.Consumer. There are several places where we diff --git a/src/components/SafeAreaConsumer/types.ts b/src/components/SafeAreaConsumer/types.ts index bc81de96a082..432bf3f25ca1 100644 --- a/src/components/SafeAreaConsumer/types.ts +++ b/src/components/SafeAreaConsumer/types.ts @@ -1,5 +1,5 @@ -import {DimensionValue} from 'react-native'; -import {EdgeInsets} from 'react-native-safe-area-context'; +import type {DimensionValue} from 'react-native'; +import type {EdgeInsets} from 'react-native-safe-area-context'; type ChildrenProps = { paddingTop?: DimensionValue; diff --git a/src/components/ScreenWrapper.tsx b/src/components/ScreenWrapper.tsx index 9a7dc8de633a..0653e2ff8577 100644 --- a/src/components/ScreenWrapper.tsx +++ b/src/components/ScreenWrapper.tsx @@ -1,9 +1,11 @@ import {useNavigation} from '@react-navigation/native'; -import {StackNavigationProp} from '@react-navigation/stack'; -import React, {ForwardedRef, forwardRef, ReactNode, useEffect, useRef, useState} from 'react'; -import {DimensionValue, Keyboard, PanResponder, StyleProp, View, ViewStyle} from 'react-native'; +import type {StackNavigationProp} from '@react-navigation/stack'; +import type {ForwardedRef, ReactNode} from 'react'; +import React, {forwardRef, useEffect, useRef, useState} from 'react'; +import type {DimensionValue, StyleProp, ViewStyle} from 'react-native'; +import {Keyboard, PanResponder, View} from 'react-native'; import {PickerAvoidingView} from 'react-native-picker-select'; -import {EdgeInsets} from 'react-native-safe-area-context'; +import type {EdgeInsets} from 'react-native-safe-area-context'; import useEnvironment from '@hooks/useEnvironment'; import useInitialDimensions from '@hooks/useInitialWindowDimensions'; import useKeyboardState from '@hooks/useKeyboardState'; @@ -11,7 +13,7 @@ import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as Browser from '@libs/Browser'; -import {RootStackParamList} from '@libs/Navigation/types'; +import type {RootStackParamList} from '@libs/Navigation/types'; import toggleTestToolsModal from '@userActions/TestTool'; import CONST from '@src/CONST'; import CustomDevMenu from './CustomDevMenu'; diff --git a/src/components/ScrollViewWithContext.tsx b/src/components/ScrollViewWithContext.tsx index 7c75ae2f71b2..478a0555e89e 100644 --- a/src/components/ScrollViewWithContext.tsx +++ b/src/components/ScrollViewWithContext.tsx @@ -1,5 +1,7 @@ -import React, {ForwardedRef, useMemo, useRef, useState} from 'react'; -import {NativeScrollEvent, NativeSyntheticEvent, ScrollView} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {useMemo, useRef, useState} from 'react'; +import type {NativeScrollEvent, NativeSyntheticEvent} from 'react-native'; +import {ScrollView} from 'react-native'; const MIN_SMOOTH_SCROLL_EVENT_THROTTLE = 16; diff --git a/src/components/Search.tsx b/src/components/Search.tsx index 10820f44738d..0b02c5dc5b5b 100644 --- a/src/components/Search.tsx +++ b/src/components/Search.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {GestureResponderEvent, StyleProp, View, ViewStyle} from 'react-native'; +import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; diff --git a/src/components/SectionList/index.android.tsx b/src/components/SectionList/index.android.tsx index 82477fffc3ee..1aa9b501146c 100644 --- a/src/components/SectionList/index.android.tsx +++ b/src/components/SectionList/index.android.tsx @@ -1,6 +1,6 @@ import React, {forwardRef} from 'react'; import {SectionList as RNSectionList} from 'react-native'; -import ForwardedSectionList from './types'; +import type ForwardedSectionList from './types'; // eslint-disable-next-line react/function-component-definition const SectionListWithRef: ForwardedSectionList = (props, ref) => ( diff --git a/src/components/SectionList/index.tsx b/src/components/SectionList/index.tsx index 1c89b50468dd..4af7ad33705c 100644 --- a/src/components/SectionList/index.tsx +++ b/src/components/SectionList/index.tsx @@ -1,6 +1,6 @@ import React, {forwardRef} from 'react'; import {SectionList as RNSectionList} from 'react-native'; -import ForwardedSectionList from './types'; +import type ForwardedSectionList from './types'; // eslint-disable-next-line react/function-component-definition const SectionList: ForwardedSectionList = (props, ref) => ( diff --git a/src/components/SectionList/types.ts b/src/components/SectionList/types.ts index 093cb8f4e77c..4648172aabfd 100644 --- a/src/components/SectionList/types.ts +++ b/src/components/SectionList/types.ts @@ -1,5 +1,5 @@ -import {ForwardedRef} from 'react'; -import {SectionList, SectionListProps} from 'react-native'; +import type {ForwardedRef} from 'react'; +import type {SectionList, SectionListProps} from 'react-native'; type ForwardedSectionList = { (props: SectionListProps, ref: ForwardedRef): React.ReactNode; diff --git a/src/components/SelectCircle.tsx b/src/components/SelectCircle.tsx index 637c06f4d35f..f20257bb9611 100644 --- a/src/components/SelectCircle.tsx +++ b/src/components/SelectCircle.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import Icon from './Icon'; diff --git a/src/components/SignInPageForm/index.native.tsx b/src/components/SignInPageForm/index.native.tsx index b39e4d681bbe..0d00c754d45a 100644 --- a/src/components/SignInPageForm/index.native.tsx +++ b/src/components/SignInPageForm/index.native.tsx @@ -1,6 +1,6 @@ import React from 'react'; import FormElement from '@components/FormElement'; -import SignInPageFormProps from './types'; +import type SignInPageFormProps from './types'; function SignInPageForm(props: SignInPageFormProps) { // eslint-disable-next-line react/jsx-props-no-spreading diff --git a/src/components/SignInPageForm/index.tsx b/src/components/SignInPageForm/index.tsx index 20b93e6db1b5..b9f0fe202dd1 100644 --- a/src/components/SignInPageForm/index.tsx +++ b/src/components/SignInPageForm/index.tsx @@ -1,7 +1,7 @@ import React, {useEffect, useRef} from 'react'; -import {View} from 'react-native'; +import type {View} from 'react-native'; import FormElement from '@components/FormElement'; -import SignInPageFormProps from './types'; +import type SignInPageFormProps from './types'; const preventFormDefault = (event: SubmitEvent) => { // When enter is pressed form is submitted to action url (POST /). diff --git a/src/components/SignInPageForm/types.ts b/src/components/SignInPageForm/types.ts index 02d948f917b9..c7f71a3f7151 100644 --- a/src/components/SignInPageForm/types.ts +++ b/src/components/SignInPageForm/types.ts @@ -1,4 +1,4 @@ -import {ViewProps} from 'react-native'; +import type {ViewProps} from 'react-native'; type SignInPageFormProps = ViewProps; diff --git a/src/components/SingleChoiceQuestion.tsx b/src/components/SingleChoiceQuestion.tsx index 5b4ea54e4436..4c2ba9c34a9f 100644 --- a/src/components/SingleChoiceQuestion.tsx +++ b/src/components/SingleChoiceQuestion.tsx @@ -1,9 +1,11 @@ -import React, {ForwardedRef, forwardRef} from 'react'; -import {Text as RNText} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef} from 'react'; +import type {Text as RNText} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import type {MaybePhraseKey} from '@libs/Localize'; import FormHelpMessage from './FormHelpMessage'; -import RadioButtons, {Choice} from './RadioButtons'; +import type {Choice} from './RadioButtons'; +import RadioButtons from './RadioButtons'; import Text from './Text'; type SingleChoiceQuestionProps = { diff --git a/src/components/SingleOptionSelector.tsx b/src/components/SingleOptionSelector.tsx index bc912aacf41d..9832167e3f6a 100644 --- a/src/components/SingleOptionSelector.tsx +++ b/src/components/SingleOptionSelector.tsx @@ -3,7 +3,7 @@ import {View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; -import {TranslationPaths} from '@src/languages/types'; +import type {TranslationPaths} from '@src/languages/types'; import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; import SelectCircle from './SelectCircle'; import Text from './Text'; diff --git a/src/components/SkeletonViewContentLoader/index.native.tsx b/src/components/SkeletonViewContentLoader/index.native.tsx index 370eb2f669f1..6d275e065bb0 100644 --- a/src/components/SkeletonViewContentLoader/index.native.tsx +++ b/src/components/SkeletonViewContentLoader/index.native.tsx @@ -1,6 +1,6 @@ import React from 'react'; import SkeletonViewContentLoader from 'react-content-loader/native'; -import SkeletonViewContentLoaderProps from './types'; +import type SkeletonViewContentLoaderProps from './types'; function ContentLoader(props: SkeletonViewContentLoaderProps) { // eslint-disable-next-line react/jsx-props-no-spreading diff --git a/src/components/SkeletonViewContentLoader/index.tsx b/src/components/SkeletonViewContentLoader/index.tsx index 105e677ad7c1..ad3858a2d8d4 100644 --- a/src/components/SkeletonViewContentLoader/index.tsx +++ b/src/components/SkeletonViewContentLoader/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import SkeletonViewContentLoader from 'react-content-loader'; -import SkeletonViewContentLoaderProps from './types'; +import type SkeletonViewContentLoaderProps from './types'; function ContentLoader(props: SkeletonViewContentLoaderProps) { // eslint-disable-next-line react/jsx-props-no-spreading diff --git a/src/components/SkeletonViewContentLoader/types.ts b/src/components/SkeletonViewContentLoader/types.ts index 23f0a051e518..5f4089f316dd 100644 --- a/src/components/SkeletonViewContentLoader/types.ts +++ b/src/components/SkeletonViewContentLoader/types.ts @@ -1,5 +1,5 @@ -import {IContentLoaderProps} from 'react-content-loader'; -import {IContentLoaderProps as NativeIContentLoaderProps} from 'react-content-loader/native'; +import type {IContentLoaderProps} from 'react-content-loader'; +import type {IContentLoaderProps as NativeIContentLoaderProps} from 'react-content-loader/native'; type SkeletonViewContentLoaderProps = IContentLoaderProps & NativeIContentLoaderProps; diff --git a/src/components/SpacerView.tsx b/src/components/SpacerView.tsx index 4c54aef61ba2..23c109f7d589 100644 --- a/src/components/SpacerView.tsx +++ b/src/components/SpacerView.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import {StyleProp, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; import Animated, {useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated'; import usePrevious from '@hooks/usePrevious'; import CONST from '@src/CONST'; diff --git a/src/components/SplashScreenHider/index.native.tsx b/src/components/SplashScreenHider/index.native.tsx index 863be2f5910c..e31f391f7376 100644 --- a/src/components/SplashScreenHider/index.native.tsx +++ b/src/components/SplashScreenHider/index.native.tsx @@ -1,5 +1,6 @@ import {useCallback, useRef} from 'react'; -import {StyleSheet, ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; +import {StyleSheet} from 'react-native'; import Reanimated, {Easing, runOnJS, useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated'; import Logo from '@assets/images/new-expensify-dark.svg'; import ImageSVG from '@components/ImageSVG'; diff --git a/src/components/SplashScreenHider/types.ts b/src/components/SplashScreenHider/types.ts index ff7b2beb1520..e48bbdcee307 100644 --- a/src/components/SplashScreenHider/types.ts +++ b/src/components/SplashScreenHider/types.ts @@ -1,4 +1,4 @@ -import {ReactNode} from 'react'; +import type {ReactNode} from 'react'; type SplashScreenHiderProps = { /** Splash screen has been hidden */ diff --git a/src/components/SubscriptAvatar.tsx b/src/components/SubscriptAvatar.tsx index c102c08c89db..00cf248ad838 100644 --- a/src/components/SubscriptAvatar.tsx +++ b/src/components/SubscriptAvatar.tsx @@ -1,12 +1,12 @@ import React, {memo} from 'react'; import {View} from 'react-native'; -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import type {AvatarSource} from '@libs/UserUtils'; import CONST from '@src/CONST'; -import {AvatarType} from '@src/types/onyx/OnyxCommon'; +import type {AvatarType} from '@src/types/onyx/OnyxCommon'; import Avatar from './Avatar'; import UserDetailsTooltip from './UserDetailsTooltip'; diff --git a/src/components/SwipeableView/index.native.tsx b/src/components/SwipeableView/index.native.tsx index 91d851101d4e..67c6695c1a7f 100644 --- a/src/components/SwipeableView/index.native.tsx +++ b/src/components/SwipeableView/index.native.tsx @@ -1,7 +1,7 @@ import React, {useRef} from 'react'; import {PanResponder, View} from 'react-native'; import CONST from '@src/CONST'; -import SwipeableViewProps from './types'; +import type SwipeableViewProps from './types'; function SwipeableView({children, onSwipeDown}: SwipeableViewProps) { const minimumPixelDistance = CONST.COMPOSER_MAX_HEIGHT; diff --git a/src/components/SwipeableView/index.tsx b/src/components/SwipeableView/index.tsx index 335c3e7dcf03..d3881d2efd21 100644 --- a/src/components/SwipeableView/index.tsx +++ b/src/components/SwipeableView/index.tsx @@ -1,4 +1,4 @@ -import SwipeableViewProps from './types'; +import type SwipeableViewProps from './types'; // Swipeable View is available just on Android/iOS for now. export default ({children}: SwipeableViewProps) => children; diff --git a/src/components/SwipeableView/types.ts b/src/components/SwipeableView/types.ts index 560df7ef5a45..738e21bb73ee 100644 --- a/src/components/SwipeableView/types.ts +++ b/src/components/SwipeableView/types.ts @@ -1,4 +1,4 @@ -import {ReactNode} from 'react'; +import type {ReactNode} from 'react'; type SwipeableViewProps = { /** The content to be rendered within the SwipeableView */ diff --git a/src/components/TabSelector/TabIcon.tsx b/src/components/TabSelector/TabIcon.tsx index 3d3850a37061..31833b2fc852 100644 --- a/src/components/TabSelector/TabIcon.tsx +++ b/src/components/TabSelector/TabIcon.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {Animated, StyleSheet, View} from 'react-native'; import Icon from '@components/Icon'; import useTheme from '@hooks/useTheme'; -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; type TabIconProps = { /** Icon to display on tab */ diff --git a/src/components/TabSelector/TabSelector.tsx b/src/components/TabSelector/TabSelector.tsx index 3809460436e5..1b8b6bc1b22b 100644 --- a/src/components/TabSelector/TabSelector.tsx +++ b/src/components/TabSelector/TabSelector.tsx @@ -1,16 +1,16 @@ -import {MaterialTopTabNavigationHelpers} from '@react-navigation/material-top-tabs/lib/typescript/src/types'; -import {TabNavigationState} from '@react-navigation/native'; +import type {MaterialTopTabNavigationHelpers} from '@react-navigation/material-top-tabs/lib/typescript/src/types'; +import type {TabNavigationState} from '@react-navigation/native'; import React, {useCallback, useEffect, useMemo, useState} from 'react'; import type {Animated} from 'react-native'; import {View} from 'react-native'; import * as Expensicons from '@components/Icon/Expensicons'; -import {LocaleContextProps} from '@components/LocaleContextProvider'; +import type {LocaleContextProps} from '@components/LocaleContextProvider'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import {RootStackParamList} from '@libs/Navigation/types'; +import type {RootStackParamList} from '@libs/Navigation/types'; import CONST from '@src/CONST'; -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; import TabSelectorItem from './TabSelectorItem'; type TabSelectorProps = { diff --git a/src/components/TabSelector/TabSelectorItem.tsx b/src/components/TabSelector/TabSelectorItem.tsx index a246e1a14b54..d5507c8c83db 100644 --- a/src/components/TabSelector/TabSelectorItem.tsx +++ b/src/components/TabSelector/TabSelectorItem.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {Animated, StyleSheet} from 'react-native'; import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; import useThemeStyles from '@hooks/useThemeStyles'; -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; import TabIcon from './TabIcon'; import TabLabel from './TabLabel'; diff --git a/src/components/TaskHeaderActionButton.tsx b/src/components/TaskHeaderActionButton.tsx index b1a32b356ae1..24acdf6c5f0b 100644 --- a/src/components/TaskHeaderActionButton.tsx +++ b/src/components/TaskHeaderActionButton.tsx @@ -1,13 +1,14 @@ import React from 'react'; import {View} from 'react-native'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportUtils from '@libs/ReportUtils'; import * as Session from '@userActions/Session'; import * as Task from '@userActions/Task'; import ONYXKEYS from '@src/ONYXKEYS'; -import * as OnyxTypes from '@src/types/onyx'; +import type * as OnyxTypes from '@src/types/onyx'; import Button from './Button'; type TaskHeaderActionButtonOnyxProps = { diff --git a/src/components/TestToolMenu.tsx b/src/components/TestToolMenu.tsx index 82b597f77268..7c0b3a6e33e1 100644 --- a/src/components/TestToolMenu.tsx +++ b/src/components/TestToolMenu.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ApiUtils from '@libs/ApiUtils'; import compose from '@libs/compose'; @@ -8,8 +9,8 @@ import * as Session from '@userActions/Session'; import * as User from '@userActions/User'; import CONFIG from '@src/CONFIG'; import ONYXKEYS from '@src/ONYXKEYS'; -import NetworkOnyx from '@src/types/onyx/Network'; -import UserOnyx from '@src/types/onyx/User'; +import type NetworkOnyx from '@src/types/onyx/Network'; +import type UserOnyx from '@src/types/onyx/User'; import Button from './Button'; import {withNetwork} from './OnyxProvider'; import Switch from './Switch'; diff --git a/src/components/TestToolsModal.tsx b/src/components/TestToolsModal.tsx index 4138df64adc2..2b1ec1e84c5b 100644 --- a/src/components/TestToolsModal.tsx +++ b/src/components/TestToolsModal.tsx @@ -1,6 +1,7 @@ import React from 'react'; import {View} from 'react-native'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import useThemeStyles from '@hooks/useThemeStyles'; import toggleTestToolsModal from '@userActions/TestTool'; import CONST from '@src/CONST'; diff --git a/src/components/Text.tsx b/src/components/Text.tsx index 0d201bd253c4..f8f8a90168fa 100644 --- a/src/components/Text.tsx +++ b/src/components/Text.tsx @@ -1,10 +1,11 @@ -import React, {ForwardedRef} from 'react'; -import {Text as RNText, TextProps as RNTextProps, StyleSheet} from 'react-native'; -import type {TextStyle} from 'react-native'; +import type {ForwardedRef} from 'react'; +import React from 'react'; +import {Text as RNText, StyleSheet} from 'react-native'; +import type {TextProps as RNTextProps, TextStyle} from 'react-native'; import useTheme from '@hooks/useTheme'; import fontFamily from '@styles/utils/fontFamily'; import variables from '@styles/variables'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type TextProps = RNTextProps & ChildrenProps & { diff --git a/src/components/TextInput/BaseTextInput/index.native.tsx b/src/components/TextInput/BaseTextInput/index.native.tsx index 4f909dcf6e64..f4cc1ee9e0ba 100644 --- a/src/components/TextInput/BaseTextInput/index.native.tsx +++ b/src/components/TextInput/BaseTextInput/index.native.tsx @@ -1,13 +1,14 @@ import Str from 'expensify-common/lib/str'; import React, {forwardRef, useCallback, useEffect, useRef, useState} from 'react'; -import {ActivityIndicator, Animated, StyleSheet, TextInput, View} from 'react-native'; -import type {GestureResponderEvent, LayoutChangeEvent, NativeSyntheticEvent, StyleProp, TextInputFocusEventData, ViewStyle} from 'react-native'; +import {ActivityIndicator, Animated, StyleSheet, View} from 'react-native'; +import type {GestureResponderEvent, LayoutChangeEvent, NativeSyntheticEvent, StyleProp, TextInput, TextInputFocusEventData, ViewStyle} from 'react-native'; import Checkbox from '@components/Checkbox'; import FormHelpMessage from '@components/FormHelpMessage'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; -import RNTextInput, {type AnimatedTextInputRef} from '@components/RNTextInput'; +import RNTextInput from '@components/RNTextInput'; +import type {AnimatedTextInputRef} from '@components/RNTextInput'; import SwipeInterceptPanResponder from '@components/SwipeInterceptPanResponder'; import Text from '@components/Text'; import * as styleConst from '@components/TextInput/styleConst'; diff --git a/src/components/TextInput/BaseTextInput/index.tsx b/src/components/TextInput/BaseTextInput/index.tsx index a66df0496a1a..d548041b0cf8 100644 --- a/src/components/TextInput/BaseTextInput/index.tsx +++ b/src/components/TextInput/BaseTextInput/index.tsx @@ -1,13 +1,14 @@ import Str from 'expensify-common/lib/str'; import React, {forwardRef, useCallback, useEffect, useMemo, useRef, useState} from 'react'; -import {ActivityIndicator, Animated, StyleSheet, TextInput, View} from 'react-native'; -import type {GestureResponderEvent, LayoutChangeEvent, NativeSyntheticEvent, StyleProp, TextInputFocusEventData, ViewStyle} from 'react-native'; +import {ActivityIndicator, Animated, StyleSheet, View} from 'react-native'; +import type {GestureResponderEvent, LayoutChangeEvent, NativeSyntheticEvent, StyleProp, TextInput, TextInputFocusEventData, ViewStyle} from 'react-native'; import Checkbox from '@components/Checkbox'; import FormHelpMessage from '@components/FormHelpMessage'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; -import RNTextInput, {AnimatedTextInputRef} from '@components/RNTextInput'; +import type {AnimatedTextInputRef} from '@components/RNTextInput'; +import RNTextInput from '@components/RNTextInput'; import SwipeInterceptPanResponder from '@components/SwipeInterceptPanResponder'; import Text from '@components/Text'; import * as styleConst from '@components/TextInput/styleConst'; diff --git a/src/components/TextInput/BaseTextInput/types.ts b/src/components/TextInput/BaseTextInput/types.ts index 2b8264af815b..f8376219d80f 100644 --- a/src/components/TextInput/BaseTextInput/types.ts +++ b/src/components/TextInput/BaseTextInput/types.ts @@ -2,7 +2,7 @@ import type {Component, ForwardedRef} from 'react'; import type {GestureResponderEvent, StyleProp, TextInputProps, TextStyle, ViewStyle} from 'react-native'; import type {AnimatedProps} from 'react-native-reanimated'; import type {MaybePhraseKey} from '@libs/Localize'; -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; type CustomBaseTextInputProps = { /** Input label */ diff --git a/src/components/TextInput/TextInputLabel/index.tsx b/src/components/TextInput/TextInputLabel/index.tsx index 628de2970331..507d40f475a7 100644 --- a/src/components/TextInput/TextInputLabel/index.tsx +++ b/src/components/TextInput/TextInputLabel/index.tsx @@ -1,5 +1,6 @@ import React, {useEffect, useRef} from 'react'; -import {Animated, Text} from 'react-native'; +import type {Text} from 'react-native'; +import {Animated} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; import type TextInputLabelProps from './types'; diff --git a/src/components/TextInput/TextInputLabel/types.ts b/src/components/TextInput/TextInputLabel/types.ts index 6f85eef18f42..e8ec50ffb0c5 100644 --- a/src/components/TextInput/TextInputLabel/types.ts +++ b/src/components/TextInput/TextInputLabel/types.ts @@ -1,4 +1,4 @@ -import {Animated} from 'react-native'; +import type {Animated} from 'react-native'; type TextInputLabelProps = { /** Label */ diff --git a/src/components/TextLink.tsx b/src/components/TextLink.tsx index 1a67e7bc4c5f..d3c515115d56 100644 --- a/src/components/TextLink.tsx +++ b/src/components/TextLink.tsx @@ -1,10 +1,12 @@ -import React, {ForwardedRef, forwardRef, KeyboardEventHandler, MouseEventHandler} from 'react'; -import {GestureResponderEvent, Text as RNText, StyleProp, TextStyle} from 'react-native'; +import type {ForwardedRef, KeyboardEventHandler, MouseEventHandler} from 'react'; +import React, {forwardRef} from 'react'; +import type {GestureResponderEvent, Text as RNText, StyleProp, TextStyle} from 'react-native'; import useEnvironment from '@hooks/useEnvironment'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Link from '@userActions/Link'; import CONST from '@src/CONST'; -import Text, {TextProps} from './Text'; +import type {TextProps} from './Text'; +import Text from './Text'; type LinkProps = { /** Link to open in new tab */ diff --git a/src/components/TextWithEllipsis/index.tsx b/src/components/TextWithEllipsis/index.tsx index fda0d5ab576e..1efbece7d49e 100644 --- a/src/components/TextWithEllipsis/index.tsx +++ b/src/components/TextWithEllipsis/index.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'; +import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import Text from '@components/Text'; import useThemeStyles from '@hooks/useThemeStyles'; diff --git a/src/components/ThemeProvider.tsx b/src/components/ThemeProvider.tsx index 34bc32be9c99..f3d2d9e64ca7 100644 --- a/src/components/ThemeProvider.tsx +++ b/src/components/ThemeProvider.tsx @@ -4,7 +4,7 @@ import React, {useMemo} from 'react'; import useThemePreferenceWithStaticOverride from '@hooks/useThemePreferenceWithStaticOverride'; import themes from '@styles/theme'; import ThemeContext from '@styles/theme/context/ThemeContext'; -import {ThemePreferenceWithoutSystem} from '@styles/theme/types'; +import type {ThemePreferenceWithoutSystem} from '@styles/theme/types'; const propTypes = { /** Rendered child component */ diff --git a/src/components/ThumbnailImage.tsx b/src/components/ThumbnailImage.tsx index 08b269e45f62..3c903ee9e78f 100644 --- a/src/components/ThumbnailImage.tsx +++ b/src/components/ThumbnailImage.tsx @@ -1,6 +1,7 @@ import lodashClamp from 'lodash/clamp'; import React, {useCallback, useState} from 'react'; -import {Dimensions, StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {Dimensions, View} from 'react-native'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; diff --git a/src/components/TimePicker/setCursorPosition/index.ios.ts b/src/components/TimePicker/setCursorPosition/index.ios.ts index 7e51abc3212e..63edf5f3dce8 100644 --- a/src/components/TimePicker/setCursorPosition/index.ios.ts +++ b/src/components/TimePicker/setCursorPosition/index.ios.ts @@ -1,4 +1,4 @@ -import SetCursorPosition from './types'; +import type SetCursorPosition from './types'; const setCursorPosition: SetCursorPosition = (position, ref, setSelection) => { const selection = { diff --git a/src/components/TimePicker/setCursorPosition/index.ts b/src/components/TimePicker/setCursorPosition/index.ts index 4d114641909f..5bfc8c1bd5da 100644 --- a/src/components/TimePicker/setCursorPosition/index.ts +++ b/src/components/TimePicker/setCursorPosition/index.ts @@ -1,4 +1,4 @@ -import SetCursorPosition from './types'; +import type SetCursorPosition from './types'; const setCursorPosition: SetCursorPosition = (position, ref, setSelection) => { setSelection({ diff --git a/src/components/TimePicker/setCursorPosition/types.ts b/src/components/TimePicker/setCursorPosition/types.ts index f7fd20a59e8e..671bf86bf209 100644 --- a/src/components/TimePicker/setCursorPosition/types.ts +++ b/src/components/TimePicker/setCursorPosition/types.ts @@ -1,5 +1,5 @@ -import {RefObject} from 'react'; -import {TextInput} from 'react-native'; +import type {RefObject} from 'react'; +import type {TextInput} from 'react-native'; type SetCursorPosition = (position: number, ref: RefObject, setSelection: (value: {start: number; end: number}) => void) => void; diff --git a/src/components/Tooltip/BaseTooltip/index.native.tsx b/src/components/Tooltip/BaseTooltip/index.native.tsx index 6d9eb24aaec5..9d4bb1079703 100644 --- a/src/components/Tooltip/BaseTooltip/index.native.tsx +++ b/src/components/Tooltip/BaseTooltip/index.native.tsx @@ -1,5 +1,5 @@ import {forwardRef} from 'react'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; // We can't use the common component for the Tooltip as Web implementation uses DOM specific method // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/src/components/Tooltip/BaseTooltip/index.tsx b/src/components/Tooltip/BaseTooltip/index.tsx index e2a2c46e4546..cf249a936f0b 100644 --- a/src/components/Tooltip/BaseTooltip/index.tsx +++ b/src/components/Tooltip/BaseTooltip/index.tsx @@ -1,10 +1,11 @@ import {BoundsObserver} from '@react-ng/bounds-observer'; -import React, {ForwardedRef, forwardRef, memo, useCallback, useEffect, useRef, useState} from 'react'; +import type {ForwardedRef} from 'react'; +import React, {forwardRef, memo, useCallback, useEffect, useRef, useState} from 'react'; import {Animated} from 'react-native'; import Hoverable from '@components/Hoverable'; import TooltipRenderedOnPageBody from '@components/Tooltip/TooltipRenderedOnPageBody'; import TooltipSense from '@components/Tooltip/TooltipSense'; -import TooltipProps from '@components/Tooltip/types'; +import type TooltipProps from '@components/Tooltip/types'; import useLocalize from '@hooks/useLocalize'; import usePrevious from '@hooks/usePrevious'; import useWindowDimensions from '@hooks/useWindowDimensions'; diff --git a/src/components/Tooltip/PopoverAnchorTooltip.tsx b/src/components/Tooltip/PopoverAnchorTooltip.tsx index e524c55f6d2f..792977ff7c43 100644 --- a/src/components/Tooltip/PopoverAnchorTooltip.tsx +++ b/src/components/Tooltip/PopoverAnchorTooltip.tsx @@ -1,8 +1,8 @@ -import {BoundsObserver} from '@react-ng/bounds-observer'; +import type {BoundsObserver} from '@react-ng/bounds-observer'; import React, {useContext, useMemo, useRef} from 'react'; import {PopoverContext} from '@components/PopoverProvider'; import BaseTooltip from './BaseTooltip'; -import {TooltipExtendedProps} from './types'; +import type {TooltipExtendedProps} from './types'; function PopoverAnchorTooltip({shouldRender = true, children, ...props}: TooltipExtendedProps) { const {isOpen, popover} = useContext(PopoverContext); diff --git a/src/components/Tooltip/TooltipRenderedOnPageBody.tsx b/src/components/Tooltip/TooltipRenderedOnPageBody.tsx index 4549f48501bf..5ffd8596e6de 100644 --- a/src/components/Tooltip/TooltipRenderedOnPageBody.tsx +++ b/src/components/Tooltip/TooltipRenderedOnPageBody.tsx @@ -6,7 +6,7 @@ import useStyleUtils from '@hooks/useStyleUtils'; import Log from '@libs/Log'; import textRef from '@src/types/utils/textRef'; import viewRef from '@src/types/utils/viewRef'; -import TooltipProps from './types'; +import type TooltipProps from './types'; type TooltipRenderedOnPageBodyProps = { /** Window width */ diff --git a/src/components/Tooltip/index.tsx b/src/components/Tooltip/index.tsx index 6d274b87badb..603698592711 100644 --- a/src/components/Tooltip/index.tsx +++ b/src/components/Tooltip/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import BaseTooltip from './BaseTooltip'; -import {TooltipExtendedProps} from './types'; +import type {TooltipExtendedProps} from './types'; function Tooltip({shouldRender = true, children, ...props}: TooltipExtendedProps) { if (!shouldRender) { diff --git a/src/components/Tooltip/types.ts b/src/components/Tooltip/types.ts index 1ca0b5f10747..253013f49761 100644 --- a/src/components/Tooltip/types.ts +++ b/src/components/Tooltip/types.ts @@ -1,5 +1,5 @@ -import {ReactNode} from 'react'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {ReactNode} from 'react'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type TooltipProps = ChildrenProps & { /** The text to display in the tooltip. If text is ommitted, only children will be rendered. */ diff --git a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.native.tsx b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.native.tsx index e490cb13c66b..6a0f59af5e03 100644 --- a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.native.tsx +++ b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.native.tsx @@ -1,4 +1,4 @@ -import UserDetailsTooltipProps from '@components/UserDetailsTooltip/types'; +import type UserDetailsTooltipProps from '@components/UserDetailsTooltip/types'; function BaseUserDetailsTooltip({children}: UserDetailsTooltipProps) { return children; diff --git a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx index a5132fc0c391..0df9993f8c69 100644 --- a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx +++ b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx @@ -4,7 +4,7 @@ import {Text, View} from 'react-native'; import Avatar from '@components/Avatar'; import {usePersonalDetails} from '@components/OnyxProvider'; import Tooltip from '@components/Tooltip'; -import UserDetailsTooltipProps from '@components/UserDetailsTooltip/types'; +import type UserDetailsTooltipProps from '@components/UserDetailsTooltip/types'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; diff --git a/src/components/UserDetailsTooltip/index.tsx b/src/components/UserDetailsTooltip/index.tsx index 1ae1688072c9..0d6bb3c3c603 100644 --- a/src/components/UserDetailsTooltip/index.tsx +++ b/src/components/UserDetailsTooltip/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import BaseUserDetailsTooltip from './BaseUserDetailsTooltip'; -import UserDetailsTooltipProps from './types'; +import type UserDetailsTooltipProps from './types'; function UserDetailsTooltip({shouldRender = true, children, ...props}: UserDetailsTooltipProps) { if (!shouldRender) { diff --git a/src/components/UserDetailsTooltip/types.tsx b/src/components/UserDetailsTooltip/types.tsx index 494bb82211e2..b362c44877a9 100644 --- a/src/components/UserDetailsTooltip/types.tsx +++ b/src/components/UserDetailsTooltip/types.tsx @@ -1,6 +1,6 @@ -import {AvatarSource} from '@libs/UserUtils'; -import {AvatarType} from '@src/types/onyx/OnyxCommon'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {AvatarSource} from '@libs/UserUtils'; +import type {AvatarType} from '@src/types/onyx/OnyxCommon'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type FallbackUserDetails = { /** The name to display in bold */ diff --git a/src/components/ValidateCode/ValidateCodeModal.tsx b/src/components/ValidateCode/ValidateCodeModal.tsx index 257912ab623a..9c83a80b0d24 100644 --- a/src/components/ValidateCode/ValidateCodeModal.tsx +++ b/src/components/ValidateCode/ValidateCodeModal.tsx @@ -1,6 +1,7 @@ import React, {useCallback} from 'react'; import {View} from 'react-native'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import * as Illustrations from '@components/Icon/Illustrations'; @@ -12,7 +13,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; import * as Session from '@userActions/Session'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Session as SessionType} from '@src/types/onyx'; +import type {Session as SessionType} from '@src/types/onyx'; type ValidateCodeModalOnyxProps = { /** Session of currently logged in user */ diff --git a/src/components/ViolationMessages.tsx b/src/components/ViolationMessages.tsx new file mode 100644 index 000000000000..8eb555184596 --- /dev/null +++ b/src/components/ViolationMessages.tsx @@ -0,0 +1,26 @@ +import React, {useMemo} from 'react'; +import {View} from 'react-native'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import ViolationsUtils from '@libs/ViolationsUtils'; +import type {TransactionViolation} from '@src/types/onyx'; +import Text from './Text'; + +export default function ViolationMessages({violations, isLast}: {violations: TransactionViolation[]; isLast?: boolean}) { + const styles = useThemeStyles(); + const {translate} = useLocalize(); + const violationMessages = useMemo(() => violations.map((violation) => [violation.name, ViolationsUtils.getViolationTranslation(violation, translate)]), [translate, violations]); + + return ( + + {violationMessages.map(([name, message]) => ( + + {message} + + ))} + + ); +} diff --git a/src/components/WalletSection.tsx b/src/components/WalletSection.tsx index 69c4bd259a5d..0c966367be45 100644 --- a/src/components/WalletSection.tsx +++ b/src/components/WalletSection.tsx @@ -1,7 +1,7 @@ import React from 'react'; import useThemeStyles from '@hooks/useThemeStyles'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; -import IconAsset from '@src/types/utils/IconAsset'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import type IconAsset from '@src/types/utils/IconAsset'; import Section from './Section'; type WalletSectionProps = ChildrenProps & { diff --git a/src/components/WalletStatementModal/index.native.tsx b/src/components/WalletStatementModal/index.native.tsx index f54d7c68fe95..8dbc743a02ee 100644 --- a/src/components/WalletStatementModal/index.native.tsx +++ b/src/components/WalletStatementModal/index.native.tsx @@ -1,7 +1,8 @@ import React, {useCallback, useRef} from 'react'; import {withOnyx} from 'react-native-onyx'; -import {WebView, WebViewNavigation} from 'react-native-webview'; -import {ValueOf} from 'type-fest'; +import type {WebViewNavigation} from 'react-native-webview'; +import {WebView} from 'react-native-webview'; +import type {ValueOf} from 'type-fest'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import Navigation from '@libs/Navigation/Navigation'; import * as Report from '@userActions/Report'; diff --git a/src/components/WalletStatementModal/types.ts b/src/components/WalletStatementModal/types.ts index bb926b8250ae..f6989f37f49b 100644 --- a/src/components/WalletStatementModal/types.ts +++ b/src/components/WalletStatementModal/types.ts @@ -1,4 +1,4 @@ -import {OnyxEntry} from 'react-native-onyx/lib/types'; +import type {OnyxEntry} from 'react-native-onyx/lib/types'; import type {Session} from '@src/types/onyx'; type WalletStatementOnyxProps = { diff --git a/src/components/createOnyxContext.tsx b/src/components/createOnyxContext.tsx index f7b2d6cbf297..4fb8b9a7281c 100644 --- a/src/components/createOnyxContext.tsx +++ b/src/components/createOnyxContext.tsx @@ -1,9 +1,10 @@ import Str from 'expensify-common/lib/str'; -import React, {ComponentType, createContext, ForwardedRef, forwardRef, ForwardRefExoticComponent, PropsWithoutRef, ReactNode, RefAttributes, useContext} from 'react'; +import type {ComponentType, ForwardedRef, ForwardRefExoticComponent, PropsWithoutRef, ReactNode, RefAttributes} from 'react'; +import React, {createContext, forwardRef, useContext} from 'react'; import {withOnyx} from 'react-native-onyx'; import getComponentDisplayName from '@libs/getComponentDisplayName'; -import {OnyxCollectionKey, OnyxKey, OnyxKeyValue, OnyxValues} from '@src/ONYXKEYS'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {OnyxCollectionKey, OnyxKey, OnyxKeyValue, OnyxValues} from '@src/ONYXKEYS'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type OnyxKeys = (OnyxKey | OnyxCollectionKey) & keyof OnyxValues; diff --git a/src/components/menuItemPropTypes.js b/src/components/menuItemPropTypes.js index 21e74b61b9c4..83d2feca7a0a 100644 --- a/src/components/menuItemPropTypes.js +++ b/src/components/menuItemPropTypes.js @@ -164,6 +164,9 @@ const propTypes = { /** Should check anonymous user in onPress function */ shouldCheckActionAllowedOnPress: PropTypes.bool, + /** The menu item link or function to get the link */ + link: PropTypes.oneOfType(PropTypes.func, PropTypes.string), + /** Icon should be displayed in its own color */ displayInDefaultIconColor: PropTypes.bool, }; diff --git a/src/components/withCurrentReportID.tsx b/src/components/withCurrentReportID.tsx index 3ce9eeae37b5..a452e7565b4e 100644 --- a/src/components/withCurrentReportID.tsx +++ b/src/components/withCurrentReportID.tsx @@ -1,6 +1,7 @@ -import {NavigationState} from '@react-navigation/native'; +import type {NavigationState} from '@react-navigation/native'; import PropTypes from 'prop-types'; -import React, {ComponentType, createContext, ForwardedRef, forwardRef, RefAttributes, useCallback, useMemo, useState} from 'react'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React, {createContext, forwardRef, useCallback, useMemo, useState} from 'react'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import Navigation from '@libs/Navigation/Navigation'; diff --git a/src/components/withCurrentUserPersonalDetails.tsx b/src/components/withCurrentUserPersonalDetails.tsx index 289e2254952f..9406c8634c1b 100644 --- a/src/components/withCurrentUserPersonalDetails.tsx +++ b/src/components/withCurrentUserPersonalDetails.tsx @@ -1,5 +1,7 @@ -import React, {ComponentType, ForwardedRef, RefAttributes, useMemo} from 'react'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React, {useMemo} from 'react'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import personalDetailsPropType from '@pages/personalDetailsPropType'; import CONST from '@src/CONST'; diff --git a/src/components/withEnvironment.tsx b/src/components/withEnvironment.tsx index 6054b43f97f5..bd57ed5da696 100644 --- a/src/components/withEnvironment.tsx +++ b/src/components/withEnvironment.tsx @@ -1,5 +1,6 @@ -import React, {ComponentType, createContext, ForwardedRef, forwardRef, ReactElement, ReactNode, RefAttributes, useContext, useEffect, useMemo, useState} from 'react'; -import {ValueOf} from 'type-fest'; +import type {ComponentType, ForwardedRef, ReactElement, ReactNode, RefAttributes} from 'react'; +import React, {createContext, forwardRef, useContext, useEffect, useMemo, useState} from 'react'; +import type {ValueOf} from 'type-fest'; import * as Environment from '@libs/Environment/Environment'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import CONST from '@src/CONST'; diff --git a/src/components/withKeyboardState.tsx b/src/components/withKeyboardState.tsx index 0c168a4537f5..2a74fd3e738e 100755 --- a/src/components/withKeyboardState.tsx +++ b/src/components/withKeyboardState.tsx @@ -1,8 +1,9 @@ import PropTypes from 'prop-types'; -import React, {ComponentType, createContext, ForwardedRef, forwardRef, ReactElement, RefAttributes, useEffect, useMemo, useState} from 'react'; +import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; +import React, {createContext, forwardRef, useEffect, useMemo, useState} from 'react'; import {Keyboard} from 'react-native'; import getComponentDisplayName from '@libs/getComponentDisplayName'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type KeyboardStateContextValue = { /** Whether the keyboard is open */ diff --git a/src/components/withLocalize.tsx b/src/components/withLocalize.tsx index 040ec509135e..f198ed9156e1 100755 --- a/src/components/withLocalize.tsx +++ b/src/components/withLocalize.tsx @@ -1,7 +1,9 @@ import PropTypes from 'prop-types'; -import React, {ComponentType, ForwardedRef, forwardRef, ReactElement, RefAttributes} from 'react'; +import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; +import React, {forwardRef} from 'react'; import getComponentDisplayName from '@libs/getComponentDisplayName'; -import {LocaleContext, LocaleContextProps} from './LocaleContextProvider'; +import type {LocaleContextProps} from './LocaleContextProvider'; +import {LocaleContext} from './LocaleContextProvider'; const withLocalizePropTypes = { /** Returns translated string for given locale and phrase */ diff --git a/src/components/withNavigation.tsx b/src/components/withNavigation.tsx index 88788edafb79..1d9b2a5f5cb0 100644 --- a/src/components/withNavigation.tsx +++ b/src/components/withNavigation.tsx @@ -1,7 +1,9 @@ -import {NavigationProp, useNavigation} from '@react-navigation/native'; -import React, {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import type {NavigationProp} from '@react-navigation/native'; +import {useNavigation} from '@react-navigation/native'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React from 'react'; import getComponentDisplayName from '@libs/getComponentDisplayName'; -import {RootStackParamList} from '@libs/Navigation/types'; +import type {RootStackParamList} from '@libs/Navigation/types'; type WithNavigationProps = { navigation: NavigationProp; diff --git a/src/components/withNavigationFallback.tsx b/src/components/withNavigationFallback.tsx index aa58b12d4b01..5d39f71fcb86 100644 --- a/src/components/withNavigationFallback.tsx +++ b/src/components/withNavigationFallback.tsx @@ -1,7 +1,8 @@ import {NavigationContext} from '@react-navigation/core'; -import {NavigationProp} from '@react-navigation/native'; -import {ParamListBase} from '@react-navigation/routers'; -import React, {ComponentType, ForwardedRef, forwardRef, ReactElement, RefAttributes, useContext, useMemo} from 'react'; +import type {NavigationProp} from '@react-navigation/native'; +import type {ParamListBase} from '@react-navigation/routers'; +import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; +import React, {forwardRef, useContext, useMemo} from 'react'; type AddListenerCallback = () => void; diff --git a/src/components/withNavigationFocus.tsx b/src/components/withNavigationFocus.tsx index 8dcd06ecb4c8..90a674a2e56e 100644 --- a/src/components/withNavigationFocus.tsx +++ b/src/components/withNavigationFocus.tsx @@ -1,5 +1,6 @@ import {useIsFocused} from '@react-navigation/native'; -import React, {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React from 'react'; import getComponentDisplayName from '@libs/getComponentDisplayName'; type WithNavigationFocusProps = { diff --git a/src/components/withStyleUtils.tsx b/src/components/withStyleUtils.tsx index 821587a1ae43..881aa9cbe4ae 100644 --- a/src/components/withStyleUtils.tsx +++ b/src/components/withStyleUtils.tsx @@ -1,8 +1,9 @@ import PropTypes from 'prop-types'; -import React, {ComponentType, ForwardedRef, forwardRef, ReactElement, RefAttributes} from 'react'; +import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; +import React, {forwardRef} from 'react'; import useStyleUtils from '@hooks/useStyleUtils'; import getComponentDisplayName from '@libs/getComponentDisplayName'; -import {StyleUtilsType} from '@styles/utils'; +import type {StyleUtilsType} from '@styles/utils'; const withStyleUtilsPropTypes = { StyleUtils: PropTypes.object.isRequired, diff --git a/src/components/withTheme.tsx b/src/components/withTheme.tsx index 93349e8e2ba4..b9b81d6daac2 100644 --- a/src/components/withTheme.tsx +++ b/src/components/withTheme.tsx @@ -1,8 +1,9 @@ import PropTypes from 'prop-types'; -import React, {ComponentType, ForwardedRef, forwardRef, ReactElement, RefAttributes} from 'react'; +import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; +import React, {forwardRef} from 'react'; import useTheme from '@hooks/useTheme'; import getComponentDisplayName from '@libs/getComponentDisplayName'; -import {type ThemeColors} from '@styles/theme/types'; +import type {ThemeColors} from '@styles/theme/types'; const withThemePropTypes = { theme: PropTypes.object.isRequired, diff --git a/src/components/withThemeStyles.tsx b/src/components/withThemeStyles.tsx index 0ae960bd4351..be1f26fd966c 100644 --- a/src/components/withThemeStyles.tsx +++ b/src/components/withThemeStyles.tsx @@ -1,8 +1,9 @@ import PropTypes from 'prop-types'; -import React, {ComponentType, ForwardedRef, forwardRef, ReactElement, RefAttributes} from 'react'; +import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; +import React, {forwardRef} from 'react'; import useThemeStyles from '@hooks/useThemeStyles'; import getComponentDisplayName from '@libs/getComponentDisplayName'; -import {type ThemeStyles} from '@styles/index'; +import type {ThemeStyles} from '@styles/index'; const withThemeStylesPropTypes = { themeStyles: PropTypes.object.isRequired, diff --git a/src/components/withToggleVisibilityView.tsx b/src/components/withToggleVisibilityView.tsx index 974ce3b7f855..86513f1bd0dc 100644 --- a/src/components/withToggleVisibilityView.tsx +++ b/src/components/withToggleVisibilityView.tsx @@ -1,6 +1,7 @@ -import React, {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; +import type {ComponentType, ForwardedRef, ReactElement, RefAttributes} from 'react'; +import React from 'react'; import {View} from 'react-native'; -import {SetOptional} from 'type-fest'; +import type {SetOptional} from 'type-fest'; import useThemeStyles from '@hooks/useThemeStyles'; import getComponentDisplayName from '@libs/getComponentDisplayName'; diff --git a/src/components/withViewportOffsetTop.tsx b/src/components/withViewportOffsetTop.tsx index d6c170b20480..d3e9b63ad3ee 100644 --- a/src/components/withViewportOffsetTop.tsx +++ b/src/components/withViewportOffsetTop.tsx @@ -1,4 +1,5 @@ -import React, {ComponentType, ForwardedRef, forwardRef, RefAttributes, useEffect, useState} from 'react'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React, {forwardRef, useEffect, useState} from 'react'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import addViewportResizeListener from '@libs/VisualViewport'; diff --git a/src/components/withWindowDimensions/index.native.tsx b/src/components/withWindowDimensions/index.native.tsx index 8ba385f72e4b..073c1f22575b 100644 --- a/src/components/withWindowDimensions/index.native.tsx +++ b/src/components/withWindowDimensions/index.native.tsx @@ -1,12 +1,13 @@ import PropTypes from 'prop-types'; -import React, {ComponentType, createContext, ForwardedRef, RefAttributes, useEffect, useMemo, useState} from 'react'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React, {createContext, useEffect, useMemo, useState} from 'react'; import {Dimensions} from 'react-native'; import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import getWindowHeightAdjustment from '@libs/getWindowHeightAdjustment'; import variables from '@styles/variables'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; -import {NewDimensions, WindowDimensionsContextData, WindowDimensionsProps} from './types'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {NewDimensions, WindowDimensionsContextData, WindowDimensionsProps} from './types'; const WindowDimensionsContext = createContext(null); const windowDimensionsPropTypes = { diff --git a/src/components/withWindowDimensions/index.tsx b/src/components/withWindowDimensions/index.tsx index aa9fc2181a36..b2a3a58726bf 100644 --- a/src/components/withWindowDimensions/index.tsx +++ b/src/components/withWindowDimensions/index.tsx @@ -1,13 +1,14 @@ import lodashDebounce from 'lodash/debounce'; import PropTypes from 'prop-types'; -import React, {ComponentType, createContext, ForwardedRef, RefAttributes, useEffect, useMemo, useState} from 'react'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React, {createContext, useEffect, useMemo, useState} from 'react'; import {Dimensions} from 'react-native'; import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import getWindowHeightAdjustment from '@libs/getWindowHeightAdjustment'; import variables from '@styles/variables'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; -import {NewDimensions, WindowDimensionsContextData, WindowDimensionsProps} from './types'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {NewDimensions, WindowDimensionsContextData, WindowDimensionsProps} from './types'; const WindowDimensionsContext = createContext(null); const windowDimensionsPropTypes = { diff --git a/src/components/withWindowDimensions/types.ts b/src/components/withWindowDimensions/types.ts index 514c86616b87..da06bb6a886e 100644 --- a/src/components/withWindowDimensions/types.ts +++ b/src/components/withWindowDimensions/types.ts @@ -1,4 +1,4 @@ -import {ScaledSize} from 'react-native'; +import type {ScaledSize} from 'react-native'; type WindowDimensionsContextData = { windowHeight: number; diff --git a/src/hooks/useActiveElement/index.native.ts b/src/hooks/useActiveElement/index.native.ts index 22e1ed7e0041..8683684f8167 100644 --- a/src/hooks/useActiveElement/index.native.ts +++ b/src/hooks/useActiveElement/index.native.ts @@ -1,4 +1,4 @@ -import UseActiveElement from './types'; +import type UseActiveElement from './types'; /** * Native doesn't have the DOM, so we just return null. diff --git a/src/hooks/useActiveElement/index.ts b/src/hooks/useActiveElement/index.ts index bee0dde6b427..6026b4f5eb80 100644 --- a/src/hooks/useActiveElement/index.ts +++ b/src/hooks/useActiveElement/index.ts @@ -1,5 +1,5 @@ import {useEffect, useState} from 'react'; -import UseActiveElement from './types'; +import type UseActiveElement from './types'; /** * Listens for the focusin and focusout events and sets the DOM activeElement to the state. diff --git a/src/hooks/useAppFocusEvent/index.native.ts b/src/hooks/useAppFocusEvent/index.native.ts index e7df6fb8054b..f2ef1e7f4321 100644 --- a/src/hooks/useAppFocusEvent/index.native.ts +++ b/src/hooks/useAppFocusEvent/index.native.ts @@ -1,6 +1,6 @@ import {useEffect} from 'react'; import {AppState} from 'react-native'; -import {UseAppFocusEvent, UseAppFocusEventCallback} from './types'; +import type {UseAppFocusEvent, UseAppFocusEventCallback} from './types'; const useAppFocusEvent: UseAppFocusEvent = (callback: UseAppFocusEventCallback) => { useEffect(() => { diff --git a/src/hooks/useAppFocusEvent/index.ts b/src/hooks/useAppFocusEvent/index.ts index d4b6772733f8..96038c98bfe6 100644 --- a/src/hooks/useAppFocusEvent/index.ts +++ b/src/hooks/useAppFocusEvent/index.ts @@ -1,5 +1,5 @@ import {useEffect} from 'react'; -import {UseAppFocusEvent, UseAppFocusEventCallback} from './types'; +import type {UseAppFocusEvent, UseAppFocusEventCallback} from './types'; /** * Runs the given callback when the app is focused (eg: after re-opening the app, switching tabs, or focusing the window) diff --git a/src/hooks/useAutoFocusInput.ts b/src/hooks/useAutoFocusInput.ts index ad66a01b157d..20d0dee1f407 100644 --- a/src/hooks/useAutoFocusInput.ts +++ b/src/hooks/useAutoFocusInput.ts @@ -1,6 +1,7 @@ import {useFocusEffect} from '@react-navigation/native'; import {useCallback, useContext, useEffect, useRef, useState} from 'react'; -import {InteractionManager, TextInput} from 'react-native'; +import type {TextInput} from 'react-native'; +import {InteractionManager} from 'react-native'; import CONST from '@src/CONST'; import * as Expensify from '@src/Expensify'; diff --git a/src/hooks/useCurrentReportID.tsx b/src/hooks/useCurrentReportID.tsx index 8514a474706b..d2934cd65b62 100644 --- a/src/hooks/useCurrentReportID.tsx +++ b/src/hooks/useCurrentReportID.tsx @@ -1,5 +1,6 @@ import {useContext} from 'react'; -import {CurrentReportIDContext, CurrentReportIDContextValue} from '@components/withCurrentReportID'; +import type {CurrentReportIDContextValue} from '@components/withCurrentReportID'; +import {CurrentReportIDContext} from '@components/withCurrentReportID'; export default function useCurrentReportID(): CurrentReportIDContextValue | null { return useContext(CurrentReportIDContext); diff --git a/src/hooks/useDebounce.ts b/src/hooks/useDebounce.ts index 7fc8332ba6cc..c3d6c22abf86 100644 --- a/src/hooks/useDebounce.ts +++ b/src/hooks/useDebounce.ts @@ -1,4 +1,4 @@ -import {DebouncedFunc, DebounceSettings} from 'lodash'; +import type {DebouncedFunc, DebounceSettings} from 'lodash'; import lodashDebounce from 'lodash/debounce'; import {useCallback, useEffect, useRef} from 'react'; diff --git a/src/hooks/useDefaultDragAndDrop/index.native.ts b/src/hooks/useDefaultDragAndDrop/index.native.ts index 08b2606d984d..e571e9d0d2b7 100644 --- a/src/hooks/useDefaultDragAndDrop/index.native.ts +++ b/src/hooks/useDefaultDragAndDrop/index.native.ts @@ -1,4 +1,4 @@ -import UseDefaultDragAndDrop from './types'; +import type UseDefaultDragAndDrop from './types'; const useDefaultDragAndDrop: UseDefaultDragAndDrop = () => {}; diff --git a/src/hooks/useDefaultDragAndDrop/index.ts b/src/hooks/useDefaultDragAndDrop/index.ts index 033110c143c8..7800e8fe349b 100644 --- a/src/hooks/useDefaultDragAndDrop/index.ts +++ b/src/hooks/useDefaultDragAndDrop/index.ts @@ -1,5 +1,5 @@ import {useEffect} from 'react'; -import UseDefaultDragAndDrop from './types'; +import type UseDefaultDragAndDrop from './types'; const useDefaultDragAndDrop: UseDefaultDragAndDrop = () => { useEffect(() => { diff --git a/src/hooks/useDelayedInputFocus.ts b/src/hooks/useDelayedInputFocus.ts index d062f8a03d25..41132ae3f656 100644 --- a/src/hooks/useDelayedInputFocus.ts +++ b/src/hooks/useDelayedInputFocus.ts @@ -1,6 +1,7 @@ import {useFocusEffect} from '@react-navigation/native'; -import {MutableRefObject, useCallback, useRef} from 'react'; -import {TextInput} from 'react-native'; +import type {MutableRefObject} from 'react'; +import {useCallback, useRef} from 'react'; +import type {TextInput} from 'react-native'; import CONST from '@src/CONST'; /** diff --git a/src/hooks/useDragAndDrop.ts b/src/hooks/useDragAndDrop.ts index 21f48921c187..8c9054dc0bf1 100644 --- a/src/hooks/useDragAndDrop.ts +++ b/src/hooks/useDragAndDrop.ts @@ -1,6 +1,7 @@ import {useIsFocused} from '@react-navigation/native'; -import React, {useCallback, useContext, useEffect, useState} from 'react'; -import {View} from 'react-native'; +import type React from 'react'; +import {useCallback, useContext, useEffect, useState} from 'react'; +import type {View} from 'react-native'; import {PopoverContext} from '@components/PopoverProvider'; const COPY_DROP_EFFECT = 'copy'; diff --git a/src/hooks/useFlipper/index.native.ts b/src/hooks/useFlipper/index.native.ts index df1aa3bf513b..0591eec50acc 100644 --- a/src/hooks/useFlipper/index.native.ts +++ b/src/hooks/useFlipper/index.native.ts @@ -1,5 +1,5 @@ import {useFlipper as useFlipperRN} from '@react-navigation/devtools'; -import UseFlipper from './types'; +import type UseFlipper from './types'; const useFlipper: UseFlipper = useFlipperRN; diff --git a/src/hooks/useFlipper/index.ts b/src/hooks/useFlipper/index.ts index 26d4c9659ad8..871bff4a7321 100644 --- a/src/hooks/useFlipper/index.ts +++ b/src/hooks/useFlipper/index.ts @@ -1,4 +1,4 @@ -import UseFlipper from './types'; +import type UseFlipper from './types'; const useFlipper: UseFlipper = () => {}; diff --git a/src/hooks/useFlipper/types.ts b/src/hooks/useFlipper/types.ts index a995414e5dd1..e69272fcb92c 100644 --- a/src/hooks/useFlipper/types.ts +++ b/src/hooks/useFlipper/types.ts @@ -1,5 +1,5 @@ -import {NavigationContainerRefWithCurrent} from '@react-navigation/core'; -import {RootStackParamList} from '@libs/Navigation/types'; +import type {NavigationContainerRefWithCurrent} from '@react-navigation/core'; +import type {RootStackParamList} from '@libs/Navigation/types'; type UseFlipper = (ref: NavigationContainerRefWithCurrent) => void; diff --git a/src/hooks/useInitialWindowDimensions/index.ts b/src/hooks/useInitialWindowDimensions/index.ts index e0882e820e9b..6dbb116e2e88 100644 --- a/src/hooks/useInitialWindowDimensions/index.ts +++ b/src/hooks/useInitialWindowDimensions/index.ts @@ -1,6 +1,7 @@ // eslint-disable-next-line no-restricted-imports import {useEffect, useState} from 'react'; -import {Dimensions, type ScaledSize} from 'react-native'; +import {Dimensions} from 'react-native'; +import type {ScaledSize} from 'react-native'; type InitialWindowDimensions = { initialWidth: number; diff --git a/src/hooks/useKeyboardShortcut.ts b/src/hooks/useKeyboardShortcut.ts index 461f01a74837..6bf8b2c52bc3 100644 --- a/src/hooks/useKeyboardShortcut.ts +++ b/src/hooks/useKeyboardShortcut.ts @@ -1,6 +1,6 @@ import {useEffect} from 'react'; -import {GestureResponderEvent} from 'react-native'; -import {ValueOf} from 'type-fest'; +import type {GestureResponderEvent} from 'react-native'; +import type {ValueOf} from 'type-fest'; import KeyboardShortcut from '@libs/KeyboardShortcut'; import CONST from '@src/CONST'; diff --git a/src/hooks/useKeyboardState.ts b/src/hooks/useKeyboardState.ts index edcbaa32cc9e..439f626ddcdd 100644 --- a/src/hooks/useKeyboardState.ts +++ b/src/hooks/useKeyboardState.ts @@ -1,5 +1,6 @@ import {useContext} from 'react'; -import {KeyboardStateContext, KeyboardStateContextValue} from '@components/withKeyboardState'; +import type {KeyboardStateContextValue} from '@components/withKeyboardState'; +import {KeyboardStateContext} from '@components/withKeyboardState'; /** * Hook for getting current state of keyboard diff --git a/src/hooks/useLocalize.ts b/src/hooks/useLocalize.ts index 2875577ef00f..6259187e433f 100644 --- a/src/hooks/useLocalize.ts +++ b/src/hooks/useLocalize.ts @@ -1,5 +1,6 @@ import {useContext} from 'react'; -import {LocaleContext, LocaleContextProps} from '@components/LocaleContextProvider'; +import type {LocaleContextProps} from '@components/LocaleContextProvider'; +import {LocaleContext} from '@components/LocaleContextProvider'; export default function useLocalize(): LocaleContextProps { return useContext(LocaleContext); diff --git a/src/hooks/useLocationBias.ts b/src/hooks/useLocationBias.ts new file mode 100644 index 000000000000..b95ffbb57e9d --- /dev/null +++ b/src/hooks/useLocationBias.ts @@ -0,0 +1,52 @@ +import {useMemo} from 'react'; + +/** + * Construct the rectangular boundary based on user location and waypoints + */ +export default function useLocationBias(allWaypoints: Record, userLocation?: {latitude: number; longitude: number}) { + return useMemo(() => { + const hasFilledWaypointCount = Object.values(allWaypoints).some((waypoint) => Object.keys(waypoint).length > 0); + // If there are no filled wayPoints and if user's current location cannot be retrieved, + // it is futile to arrive at a biased location. Let's return + if (!hasFilledWaypointCount && userLocation === undefined) { + return null; + } + + // Gather the longitudes and latitudes from filled waypoints. + const longitudes: number[] = Object.values(allWaypoints).reduce((accum: number[], waypoint) => { + if (waypoint?.lng) { + accum.push(waypoint.lng); + } + return accum; + }, []); + const latitudes: number[] = Object.values(allWaypoints).reduce((accum: number[], waypoint) => { + if (waypoint?.lat) { + accum.push(waypoint.lat); + } + return accum; + }, []); + + // When no filled waypoints are available but the current location of the user is available, + // let us consider the current user's location to construct a rectangular bound + if (!hasFilledWaypointCount && userLocation !== undefined) { + longitudes.push(userLocation.longitude); + latitudes.push(userLocation.latitude); + } + + // Extend the rectangular bound by 0.5 degree (roughly around 25-30 miles in US) + const minLat = Math.min(...latitudes) - 0.5; + const minLng = Math.min(...longitudes) - 0.5; + const maxLat = Math.max(...latitudes) + 0.5; + const maxLng = Math.max(...longitudes) + 0.5; + + // Ensuring coordinates do not go out of range. + const south = minLat > -90 ? minLat : -90; + const west = minLng > -180 ? minLng : -180; + const north = maxLat < 90 ? maxLat : 90; + const east = maxLng < 180 ? maxLng : 180; + + // Format: rectangle:south,west|north,east + const rectFormat = `rectangle:${south},${west}|${north},${east}`; + return rectFormat; + }, [userLocation, allWaypoints]); +} diff --git a/src/hooks/useReportScrollManager/index.native.ts b/src/hooks/useReportScrollManager/index.native.ts index 24de5d8da63a..6666a4ebd0f2 100644 --- a/src/hooks/useReportScrollManager/index.native.ts +++ b/src/hooks/useReportScrollManager/index.native.ts @@ -1,6 +1,6 @@ import {useCallback, useContext} from 'react'; import {ActionListContext} from '@pages/home/ReportScreenContext'; -import ReportScrollManagerData from './types'; +import type ReportScrollManagerData from './types'; function useReportScrollManager(): ReportScrollManagerData { const {flatListRef, setScrollPosition} = useContext(ActionListContext); diff --git a/src/hooks/useReportScrollManager/index.ts b/src/hooks/useReportScrollManager/index.ts index 032417ed9fde..8b56cd639d08 100644 --- a/src/hooks/useReportScrollManager/index.ts +++ b/src/hooks/useReportScrollManager/index.ts @@ -1,6 +1,6 @@ import {useCallback, useContext} from 'react'; import {ActionListContext} from '@pages/home/ReportScreenContext'; -import ReportScrollManagerData from './types'; +import type ReportScrollManagerData from './types'; function useReportScrollManager(): ReportScrollManagerData { const {flatListRef} = useContext(ActionListContext); diff --git a/src/hooks/useReportScrollManager/types.ts b/src/hooks/useReportScrollManager/types.ts index a0d7f14f7b84..5182f7269a9c 100644 --- a/src/hooks/useReportScrollManager/types.ts +++ b/src/hooks/useReportScrollManager/types.ts @@ -1,4 +1,4 @@ -import {FlatListRefType} from '@pages/home/ReportScreenContext'; +import type {FlatListRefType} from '@pages/home/ReportScreenContext'; type ReportScrollManagerData = { ref: FlatListRefType; diff --git a/src/hooks/useResponsiveLayout.ts b/src/hooks/useResponsiveLayout.ts index b386fc985604..dd782a9dbba5 100644 --- a/src/hooks/useResponsiveLayout.ts +++ b/src/hooks/useResponsiveLayout.ts @@ -1,4 +1,5 @@ -import {ParamListBase, RouteProp, useRoute} from '@react-navigation/native'; +import type {ParamListBase, RouteProp} from '@react-navigation/native'; +import {useRoute} from '@react-navigation/native'; import useWindowDimensions from './useWindowDimensions'; type RouteParams = ParamListBase & { diff --git a/src/hooks/useSafeAreaInsets/index.android.ts b/src/hooks/useSafeAreaInsets/index.android.ts index 55a83d425543..66500dd37887 100644 --- a/src/hooks/useSafeAreaInsets/index.android.ts +++ b/src/hooks/useSafeAreaInsets/index.android.ts @@ -1,5 +1,6 @@ +import type {EdgeInsets} from 'react-native-safe-area-context'; // eslint-disable-next-line no-restricted-imports -import {EdgeInsets, useSafeAreaInsets as useSafeAreaInsetsInternal} from 'react-native-safe-area-context'; +import {useSafeAreaInsets as useSafeAreaInsetsInternal} from 'react-native-safe-area-context'; import StatusBar from '@libs/StatusBar'; function useSafeAreaInsets(): EdgeInsets { diff --git a/src/hooks/useScrollContext.ts b/src/hooks/useScrollContext.ts index 711c8326bdff..3adb91fe2abf 100644 --- a/src/hooks/useScrollContext.ts +++ b/src/hooks/useScrollContext.ts @@ -1,5 +1,6 @@ import {useContext} from 'react'; -import {ScrollContext, ScrollContextValue} from '@components/ScrollViewWithContext'; +import type {ScrollContextValue} from '@components/ScrollViewWithContext'; +import {ScrollContext} from '@components/ScrollViewWithContext'; export default function useScrollContext(): ScrollContextValue { return useContext(ScrollContext); diff --git a/src/hooks/useTabNavigatorFocus/index.ts b/src/hooks/useTabNavigatorFocus/index.ts index 9138cbbdab48..7c721717769e 100644 --- a/src/hooks/useTabNavigatorFocus/index.ts +++ b/src/hooks/useTabNavigatorFocus/index.ts @@ -1,7 +1,7 @@ import {useTabAnimation} from '@react-navigation/material-top-tabs'; import {useIsFocused} from '@react-navigation/native'; import {useEffect, useState} from 'react'; -import {Animated} from 'react-native'; +import type {Animated} from 'react-native'; import DomUtils from '@libs/DomUtils'; type UseTabNavigatorFocusParams = { diff --git a/src/hooks/useTheme.ts b/src/hooks/useTheme.ts index 966e9b499e2f..7ba813145ebb 100644 --- a/src/hooks/useTheme.ts +++ b/src/hooks/useTheme.ts @@ -1,6 +1,6 @@ import {useContext} from 'react'; import ThemeContext from '@styles/theme/context/ThemeContext'; -import {type ThemeColors} from '@styles/theme/types'; +import type {ThemeColors} from '@styles/theme/types'; function useTheme(): ThemeColors { const theme = useContext(ThemeContext); diff --git a/src/hooks/useThemePreference.ts b/src/hooks/useThemePreference.ts index 5d3ec4c3a860..ca585065c4e6 100644 --- a/src/hooks/useThemePreference.ts +++ b/src/hooks/useThemePreference.ts @@ -1,7 +1,7 @@ import {useContext, useEffect, useState} from 'react'; import {useColorScheme} from 'react-native'; import {PreferredThemeContext} from '@components/OnyxProvider'; -import {ThemePreferenceWithoutSystem} from '@styles/theme/types'; +import type {ThemePreferenceWithoutSystem} from '@styles/theme/types'; import CONST from '@src/CONST'; function useThemePreference() { diff --git a/src/hooks/useThemePreferenceWithStaticOverride.ts b/src/hooks/useThemePreferenceWithStaticOverride.ts index 4619da1966ce..96e4db61e24f 100644 --- a/src/hooks/useThemePreferenceWithStaticOverride.ts +++ b/src/hooks/useThemePreferenceWithStaticOverride.ts @@ -1,4 +1,4 @@ -import {ThemePreferenceWithoutSystem} from '@styles/theme/types'; +import type {ThemePreferenceWithoutSystem} from '@styles/theme/types'; import useThemePreference from './useThemePreference'; const useThemePreferenceWithStaticOverride = (staticThemePreference: ThemePreferenceWithoutSystem | undefined) => { diff --git a/src/hooks/useViolations.ts b/src/hooks/useViolations.ts index 3aef5cd9b716..76d48158237b 100644 --- a/src/hooks/useViolations.ts +++ b/src/hooks/useViolations.ts @@ -1,13 +1,13 @@ import {useCallback, useMemo} from 'react'; -import {TransactionViolation, ViolationName} from '@src/types/onyx'; +import type {TransactionViolation, ViolationName} from '@src/types/onyx'; /** - * Names of Fields where violations can occur + * Names of Fields where violations can occur. */ type ViolationField = 'amount' | 'billable' | 'category' | 'comment' | 'date' | 'merchant' | 'receipt' | 'tag' | 'tax'; /** - * Map from Violation Names to the field where that violation can occur + * Map from Violation Names to the field where that violation can occur. */ const violationFields: Record = { allTagLevelsRequired: 'tag', @@ -60,13 +60,12 @@ function useViolations(violations: TransactionViolation[]) { return violationGroups ?? new Map(); }, [violations]); - const hasViolations = useCallback((field: ViolationField) => Boolean(violationsByField.get(field)?.length), [violationsByField]); const getViolationsForField = useCallback((field: ViolationField) => violationsByField.get(field) ?? [], [violationsByField]); return { - hasViolations, getViolationsForField, }; } export default useViolations; +export type {ViolationField}; diff --git a/src/hooks/useWindowDimensions/index.native.ts b/src/hooks/useWindowDimensions/index.native.ts index e0268445fe4e..5d556234aeb9 100644 --- a/src/hooks/useWindowDimensions/index.native.ts +++ b/src/hooks/useWindowDimensions/index.native.ts @@ -1,7 +1,7 @@ // eslint-disable-next-line no-restricted-imports import {useWindowDimensions} from 'react-native'; import variables from '@styles/variables'; -import WindowDimensions from './types'; +import type WindowDimensions from './types'; /** * A convenience wrapper around React Native's useWindowDimensions hook that also provides booleans for our breakpoints. diff --git a/src/hooks/useWindowDimensions/index.ts b/src/hooks/useWindowDimensions/index.ts index ab856bcf8e1b..b0a29e9f901b 100644 --- a/src/hooks/useWindowDimensions/index.ts +++ b/src/hooks/useWindowDimensions/index.ts @@ -1,7 +1,7 @@ // eslint-disable-next-line no-restricted-imports import {Dimensions, useWindowDimensions} from 'react-native'; import variables from '@styles/variables'; -import WindowDimensions from './types'; +import type WindowDimensions from './types'; /** * A convenience wrapper around React Native's useWindowDimensions hook that also provides booleans for our breakpoints. diff --git a/src/languages/en.ts b/src/languages/en.ts index e223dd0a9aaf..6e177c1df141 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -74,6 +74,20 @@ import type { UpdatedTheDistanceParams, UpdatedTheRequestParams, UserIsAlreadyMemberParams, + ViolationsAutoReportedRejectedExpenseParams, + ViolationsCashExpenseWithNoReceiptParams, + ViolationsConversionSurchargeParams, + ViolationsInvoiceMarkupParams, + ViolationsMaxAgeParams, + ViolationsMissingTagParams, + ViolationsOverAutoApprovalLimitParams, + ViolationsOverCategoryLimitParams, + ViolationsOverLimitParams, + ViolationsPerDayLimitParams, + ViolationsReceiptRequiredParams, + ViolationsRterParams, + ViolationsTagOutOfPolicyParams, + ViolationsTaxOutOfPolicyParams, WaitingOnBankAccountParams, WalletProgramParams, WelcomeEnterMagicCodeParams, @@ -2035,38 +2049,49 @@ export default { copyReferralLink: 'Copy invite link', }, violations: { - allTagLevelsRequired: 'dummy.violations.allTagLevelsRequired', - autoReportedRejectedExpense: 'dummy.violations.autoReportedRejectedExpense', - billableExpense: 'dummy.violations.billableExpense', - cashExpenseWithNoReceipt: 'dummy.violations.cashExpenseWithNoReceipt', - categoryOutOfPolicy: 'dummy.violations.categoryOutOfPolicy', - conversionSurcharge: 'dummy.violations.conversionSurcharge', - customUnitOutOfPolicy: 'dummy.violations.customUnitOutOfPolicy', - duplicatedTransaction: 'dummy.violations.duplicatedTransaction', - fieldRequired: 'dummy.violations.fieldRequired', - futureDate: 'dummy.violations.futureDate', - invoiceMarkup: 'dummy.violations.invoiceMarkup', - maxAge: 'dummy.violations.maxAge', - missingCategory: 'dummy.violations.missingCategory', - missingComment: 'dummy.violations.missingComment', - missingTag: 'dummy.violations.missingTag', - modifiedAmount: 'dummy.violations.modifiedAmount', - modifiedDate: 'dummy.violations.modifiedDate', - nonExpensiworksExpense: 'dummy.violations.nonExpensiworksExpense', - overAutoApprovalLimit: 'dummy.violations.overAutoApprovalLimit', - overCategoryLimit: 'dummy.violations.overCategoryLimit', - overLimit: 'dummy.violations.overLimit', - overLimitAttendee: 'dummy.violations.overLimitAttendee', - perDayLimit: 'dummy.violations.perDayLimit', - receiptNotSmartScanned: 'dummy.violations.receiptNotSmartScanned', - receiptRequired: 'dummy.violations.receiptRequired', - rter: 'dummy.violations.rter', - smartscanFailed: 'dummy.violations.smartscanFailed', - someTagLevelsRequired: 'dummy.violations.someTagLevelsRequired', - tagOutOfPolicy: 'dummy.violations.tagOutOfPolicy', - taxAmountChanged: 'dummy.violations.taxAmountChanged', - taxOutOfPolicy: 'dummy.violations.taxOutOfPolicy', - taxRateChanged: 'dummy.violations.taxRateChanged', - taxRequired: 'dummy.violations.taxRequired', + allTagLevelsRequired: 'All tags required', + autoReportedRejectedExpense: ({rejectReason, rejectedBy}: ViolationsAutoReportedRejectedExpenseParams) => `${rejectedBy} rejected this expense with the comment "${rejectReason}"`, + billableExpense: 'Billable no longer valid', + cashExpenseWithNoReceipt: ({amount}: ViolationsCashExpenseWithNoReceiptParams) => `Receipt required over ${amount}`, + categoryOutOfPolicy: 'Category no longer valid', + conversionSurcharge: ({surcharge}: ViolationsConversionSurchargeParams) => `Applied ${surcharge}% conversion surcharge`, + customUnitOutOfPolicy: 'Unit no longer valid', + duplicatedTransaction: 'Potential duplicate', + fieldRequired: 'Report fields are required', + futureDate: 'Future date not allowed', + invoiceMarkup: ({invoiceMarkup}: ViolationsInvoiceMarkupParams) => `Marked up by ${invoiceMarkup}%`, + maxAge: ({maxAge}: ViolationsMaxAgeParams) => `Date older than ${maxAge} days`, + missingCategory: 'Missing category', + missingComment: 'Description required for selected category', + missingTag: ({tagName}: ViolationsMissingTagParams) => `Missing ${tagName ?? 'tag'}`, + modifiedAmount: 'Amount greater than scanned receipt', + modifiedDate: 'Date differs from scanned receipt', + nonExpensiworksExpense: 'Non-Expensiworks expense', + overAutoApprovalLimit: ({formattedLimitAmount}: ViolationsOverAutoApprovalLimitParams) => `Expense exceeds auto approval limit of ${formattedLimitAmount}`, + overCategoryLimit: ({categoryLimit}: ViolationsOverCategoryLimitParams) => `Amount over ${categoryLimit}/person category limit`, + overLimit: ({amount}: ViolationsOverLimitParams) => `Amount over ${amount}/person limit`, + overLimitAttendee: ({amount}: ViolationsOverLimitParams) => `Amount over ${amount}/person limit`, + perDayLimit: ({limit}: ViolationsPerDayLimitParams) => `Amount over daily ${limit}/person category limit`, + receiptNotSmartScanned: 'Receipt not verified. Please confirm accuracy.', + receiptRequired: ({amount, category}: ViolationsReceiptRequiredParams) => `Receipt required over ${amount} ${category ? ' category limit' : ''}`, + rter: ({brokenBankConnection, email, isAdmin, isTransactionOlderThan7Days, member}: ViolationsRterParams) => { + if (brokenBankConnection) { + return isAdmin + ? `Can't auto-match receipt due to broken bank connection which ${email} needs to fix` + : "Can't auto-match receipt due to broken bank connection which you need to fix"; + } + if (!isTransactionOlderThan7Days) { + return isAdmin ? `Ask ${member} to mark as a cash or wait 7 days and try again` : 'Awaiting merge with card transaction.'; + } + + return ''; + }, + smartscanFailed: 'Receipt scanning failed. Enter details manually.', + someTagLevelsRequired: 'Missing tag', + tagOutOfPolicy: ({tagName}: ViolationsTagOutOfPolicyParams) => `${tagName ?? ''} no longer valid`, + taxAmountChanged: 'Tax amount was modified', + taxOutOfPolicy: ({taxName}: ViolationsTaxOutOfPolicyParams) => `${taxName ?? ''} no longer valid`, + taxRateChanged: 'Tax rate was modified', + taxRequired: 'Missing tax rate', }, } satisfies TranslationBase; diff --git a/src/languages/es.ts b/src/languages/es.ts index 42743f43a098..990554b0b502 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -73,6 +73,20 @@ import type { UpdatedTheDistanceParams, UpdatedTheRequestParams, UserIsAlreadyMemberParams, + ViolationsAutoReportedRejectedExpenseParams, + ViolationsCashExpenseWithNoReceiptParams, + ViolationsConversionSurchargeParams, + ViolationsInvoiceMarkupParams, + ViolationsMaxAgeParams, + ViolationsMissingTagParams, + ViolationsOverAutoApprovalLimitParams, + ViolationsOverCategoryLimitParams, + ViolationsOverLimitParams, + ViolationsPerDayLimitParams, + ViolationsReceiptRequiredParams, + ViolationsRterParams, + ViolationsTagOutOfPolicyParams, + ViolationsTaxOutOfPolicyParams, WaitingOnBankAccountParams, WalletProgramParams, WelcomeEnterMagicCodeParams, @@ -2522,38 +2536,50 @@ export default { copyReferralLink: 'Copiar enlace de invitación', }, violations: { - allTagLevelsRequired: 'dummy.violations.allTagLevelsRequired', - autoReportedRejectedExpense: 'dummy.violations.autoReportedRejectedExpense', - billableExpense: 'dummy.violations.billableExpense', - cashExpenseWithNoReceipt: 'dummy.violations.cashExpenseWithNoReceipt', - categoryOutOfPolicy: 'dummy.violations.categoryOutOfPolicy', - conversionSurcharge: 'dummy.violations.conversionSurcharge', - customUnitOutOfPolicy: 'dummy.violations.customUnitOutOfPolicy', - duplicatedTransaction: 'dummy.violations.duplicatedTransaction', - fieldRequired: 'dummy.violations.fieldRequired', - futureDate: 'dummy.violations.futureDate', - invoiceMarkup: 'dummy.violations.invoiceMarkup', - maxAge: 'dummy.violations.maxAge', - missingCategory: 'dummy.violations.missingCategory', - missingComment: 'dummy.violations.missingComment', - missingTag: 'dummy.violations.missingTag', - modifiedAmount: 'dummy.violations.modifiedAmount', - modifiedDate: 'dummy.violations.modifiedDate', - nonExpensiworksExpense: 'dummy.violations.nonExpensiworksExpense', - overAutoApprovalLimit: 'dummy.violations.overAutoApprovalLimit', - overCategoryLimit: 'dummy.violations.overCategoryLimit', - overLimit: 'dummy.violations.overLimit', - overLimitAttendee: 'dummy.violations.overLimitAttendee', - perDayLimit: 'dummy.violations.perDayLimit', - receiptNotSmartScanned: 'dummy.violations.receiptNotSmartScanned', - receiptRequired: 'dummy.violations.receiptRequired', - rter: 'dummy.violations.rter', - smartscanFailed: 'dummy.violations.smartscanFailed', - someTagLevelsRequired: 'dummy.violations.someTagLevelsRequired', - tagOutOfPolicy: 'dummy.violations.tagOutOfPolicy', - taxAmountChanged: 'dummy.violations.taxAmountChanged', - taxOutOfPolicy: 'dummy.violations.taxOutOfPolicy', - taxRateChanged: 'dummy.violations.taxRateChanged', - taxRequired: 'dummy.violations.taxRequired', + allTagLevelsRequired: 'Todas las etiquetas son obligatorias', + autoReportedRejectedExpense: ({rejectedBy, rejectReason}: ViolationsAutoReportedRejectedExpenseParams) => `${rejectedBy} rechazó la solicitud y comentó "${rejectReason}"`, + billableExpense: 'La opción facturable ya no es válida', + cashExpenseWithNoReceipt: ({amount}: ViolationsCashExpenseWithNoReceiptParams) => `Recibo obligatorio para montos mayores a ${amount}`, + categoryOutOfPolicy: 'La categoría ya no es válida', + conversionSurcharge: ({surcharge}: ViolationsConversionSurchargeParams) => `${surcharge}% de recargo aplicado`, + customUnitOutOfPolicy: 'Unidad ya no es válida', + duplicatedTransaction: 'Potencial duplicado', + fieldRequired: 'Los campos del informe son obligatorios', + futureDate: 'Fecha futura no permitida', + invoiceMarkup: ({invoiceMarkup}: ViolationsInvoiceMarkupParams) => `Incrementado un ${invoiceMarkup}%`, + maxAge: ({maxAge}: ViolationsMaxAgeParams) => `Fecha de más de ${maxAge} días`, + missingCategory: 'Falta categoría', + missingComment: 'Descripción obligatoria para categoría seleccionada', + missingTag: ({tagName}: ViolationsMissingTagParams) => `Falta ${tagName}`, + modifiedAmount: 'Importe superior al del recibo escaneado', + modifiedDate: 'Fecha difiere del recibo escaneado', + nonExpensiworksExpense: 'Gasto no es de Expensiworks', + overAutoApprovalLimit: ({formattedLimitAmount}: ViolationsOverAutoApprovalLimitParams) => `Importe supera el límite de aprobación automática de ${formattedLimitAmount}`, + overCategoryLimit: ({categoryLimit}: ViolationsOverCategoryLimitParams) => `Importe supera el límite para la categoría de ${categoryLimit}/persona`, + overLimit: ({amount}: ViolationsOverLimitParams) => `Importe supera el límite de ${amount}/persona`, + overLimitAttendee: ({amount}: ViolationsOverLimitParams) => `Importe supera el límite de ${amount}/persona`, + perDayLimit: ({limit}: ViolationsPerDayLimitParams) => `Importe supera el límite diario de la categoría de ${limit}/persona`, + receiptNotSmartScanned: 'Recibo no verificado. Por favor, confirma su exactitud', + receiptRequired: ({amount, category}: ViolationsReceiptRequiredParams) => `Recibo obligatorio para importes sobre ${category ? 'el limite de la categoría de ' : ''}${amount}`, + rter: ({brokenBankConnection, isAdmin, email, isTransactionOlderThan7Days, member}: ViolationsRterParams) => { + if (brokenBankConnection) { + return isAdmin + ? `No se puede adjuntar recibo debido a una conexión con su banco que ${email} necesita arreglar` + : 'No se puede adjuntar recibo debido a una conexión con su banco que necesitas arreglar'; + } + if (!isTransactionOlderThan7Days) { + return isAdmin + ? `Pídele a ${member} que marque la transacción como efectivo o espera 7 días e intenta de nuevo` + : 'Esperando adjuntar automáticamente a transacción de tarjeta de crédito'; + } + return ''; + }, + smartscanFailed: 'No se pudo escanear el recibo. Introduce los datos manualmente', + someTagLevelsRequired: 'Falta etiqueta', + tagOutOfPolicy: ({tagName}: ViolationsTagOutOfPolicyParams) => `Le etiqueta ${tagName} ya no es válida`, + taxAmountChanged: 'El importe del impuesto fue modificado', + taxOutOfPolicy: ({taxName}: ViolationsTaxOutOfPolicyParams) => `${taxName} ya no es válido`, + taxRateChanged: 'La tasa de impuesto fue modificada', + taxRequired: 'Falta tasa de impuesto', }, } satisfies EnglishTranslation; diff --git a/src/languages/types.ts b/src/languages/types.ts index 427a5777b2ea..5b6e56a38689 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -1,5 +1,5 @@ -import {ReportAction} from '@src/types/onyx'; -import en from './en'; +import type {ReportAction} from '@src/types/onyx'; +import type en from './en'; type AddressLineParams = { lineNumber: number; @@ -209,6 +209,40 @@ type TagSelectionParams = {tagName: string}; type WalletProgramParams = {walletProgram: string}; +type ViolationsAutoReportedRejectedExpenseParams = {rejectedBy: string; rejectReason: string}; + +type ViolationsCashExpenseWithNoReceiptParams = {amount: string}; + +type ViolationsConversionSurchargeParams = {surcharge?: number}; + +type ViolationsInvoiceMarkupParams = {invoiceMarkup?: number}; + +type ViolationsMaxAgeParams = {maxAge: number}; + +type ViolationsMissingTagParams = {tagName?: string}; + +type ViolationsOverAutoApprovalLimitParams = {formattedLimitAmount: string}; + +type ViolationsOverCategoryLimitParams = {categoryLimit: string}; + +type ViolationsOverLimitParams = {amount: string}; + +type ViolationsPerDayLimitParams = {limit: string}; + +type ViolationsReceiptRequiredParams = {amount: string; category?: string}; + +type ViolationsRterParams = { + brokenBankConnection: boolean; + isAdmin: boolean; + email?: string; + isTransactionOlderThan7Days: boolean; + member?: string; +}; + +type ViolationsTagOutOfPolicyParams = {tagName?: string}; + +type ViolationsTaxOutOfPolicyParams = {taxName?: string}; + type TaskCreatedActionParams = {title: string}; /* Translation Object types */ @@ -250,87 +284,101 @@ type TranslationFlatObject = { }; export type { - TranslationBase, - TranslationPaths, - EnglishTranslation, - TranslationFlatObject, + ApprovedAmountParams, AddressLineParams, - CharacterLimitParams, - MaxParticipantsReachedParams, - ZipCodeExampleFormatParams, - LoggedInAsParams, - NewFaceEnterMagicCodeParams, - WelcomeEnterMagicCodeParams, AlreadySignedInParams, - GoBackMessageParams, - LocalTimeParams, - EditActionParams, - DeleteActionParams, - DeleteConfirmationParams, - BeginningOfChatHistoryDomainRoomPartOneParams, + AmountEachParams, BeginningOfChatHistoryAdminRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartTwo, - WelcomeToRoomParams, - ReportArchiveReasonsClosedParams, - ReportArchiveReasonsMergedParams, - ReportArchiveReasonsRemovedFromPolicyParams, - ReportArchiveReasonsPolicyDeletedParams, - RequestCountParams, - SettleExpensifyCardParams, - RequestAmountParams, - RequestedAmountMessageParams, - SplitAmountParams, + BeginningOfChatHistoryDomainRoomPartOneParams, + CanceledRequestParams, + CharacterLimitParams, + ConfirmThatParams, + DateShouldBeAfterParams, + DateShouldBeBeforeParams, + DeleteActionParams, + DeleteConfirmationParams, DidSplitAmountMessageParams, - AmountEachParams, + EditActionParams, + EnglishTranslation, + EnterMagicCodeParams, + FormattedMaxLengthParams, + GoBackMessageParams, + GoToRoomParams, + IncorrectZipFormatParams, + InstantSummaryParams, + LocalTimeParams, + LoggedInAsParams, + ManagerApprovedAmountParams, + ManagerApprovedParams, + MaxParticipantsReachedParams, + NewFaceEnterMagicCodeParams, + NoLongerHaveAccessParams, + NotAllowedExtensionParams, + NotYouParams, + OOOEventSummaryFullDayParams, + OOOEventSummaryPartialDayParams, + OurEmailProviderParams, + PaidElsewhereWithAmountParams, + PaidWithExpensifyWithAmountParams, + ParentNavigationSummaryParams, PayerOwesAmountParams, PayerOwesParams, PayerPaidAmountParams, PayerPaidParams, - ApprovedAmountParams, - ManagerApprovedParams, - ManagerApprovedAmountParams, PayerSettledParams, - WaitingOnBankAccountParams, - CanceledRequestParams, - SettledAfterAddedBankAccountParams, - PaidElsewhereWithAmountParams, - PaidWithExpensifyWithAmountParams, - ThreadRequestReportNameParams, - ThreadSentMoneyReportNameParams, - SizeExceededParams, + RemovedTheRequestParams, + RenamedRoomActionParams, + ReportArchiveReasonsClosedParams, + ReportArchiveReasonsMergedParams, + ReportArchiveReasonsPolicyDeletedParams, + ReportArchiveReasonsRemovedFromPolicyParams, + RequestAmountParams, + RequestCountParams, + RequestedAmountMessageParams, ResolutionConstraintsParams, - NotAllowedExtensionParams, - EnterMagicCodeParams, - TransferParams, - InstantSummaryParams, - NotYouParams, - DateShouldBeBeforeParams, - DateShouldBeAfterParams, - IncorrectZipFormatParams, - WeSentYouMagicSignInLinkParams, - ToValidateLoginParams, - NoLongerHaveAccessParams, - OurEmailProviderParams, - ConfirmThatParams, - UntilTimeParams, - StepCounterParams, - UserIsAlreadyMemberParams, - GoToRoomParams, - WelcomeNoteParams, RoomNameReservedErrorParams, - RenamedRoomActionParams, RoomRenamedToParams, - OOOEventSummaryFullDayParams, - OOOEventSummaryPartialDayParams, - ParentNavigationSummaryParams, + SetTheDistanceParams, SetTheRequestParams, - UpdatedTheRequestParams, - RemovedTheRequestParams, - FormattedMaxLengthParams, + SettleExpensifyCardParams, + SettledAfterAddedBankAccountParams, + SizeExceededParams, + SplitAmountParams, + StepCounterParams, TagSelectionParams, - SetTheDistanceParams, + TaskCreatedActionParams, + ThreadRequestReportNameParams, + ThreadSentMoneyReportNameParams, + ToValidateLoginParams, + TransferParams, + TranslationBase, + TranslationFlatObject, + TranslationPaths, + UntilTimeParams, UpdatedTheDistanceParams, + UpdatedTheRequestParams, + UserIsAlreadyMemberParams, + ViolationsAutoReportedRejectedExpenseParams, + ViolationsCashExpenseWithNoReceiptParams, + ViolationsConversionSurchargeParams, + ViolationsInvoiceMarkupParams, + ViolationsMaxAgeParams, + ViolationsMissingTagParams, + ViolationsOverAutoApprovalLimitParams, + ViolationsOverCategoryLimitParams, + ViolationsOverLimitParams, + ViolationsPerDayLimitParams, + ViolationsReceiptRequiredParams, + ViolationsRterParams, + ViolationsTagOutOfPolicyParams, + ViolationsTaxOutOfPolicyParams, + WaitingOnBankAccountParams, WalletProgramParams, - TaskCreatedActionParams, + WeSentYouMagicSignInLinkParams, + WelcomeEnterMagicCodeParams, + WelcomeNoteParams, + WelcomeToRoomParams, + ZipCodeExampleFormatParams, }; diff --git a/src/libs/API.ts b/src/libs/API.ts index 91cf6a7db877..d5cfd56cd4af 100644 --- a/src/libs/API.ts +++ b/src/libs/API.ts @@ -1,8 +1,9 @@ -import Onyx, {OnyxUpdate} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; -import OnyxRequest from '@src/types/onyx/Request'; -import Response from '@src/types/onyx/Response'; +import type OnyxRequest from '@src/types/onyx/Request'; +import type Response from '@src/types/onyx/Response'; import pkg from '../../package.json'; import Log from './Log'; import * as Middleware from './Middleware'; diff --git a/src/libs/Accessibility/index.ts b/src/libs/Accessibility/index.ts index aa167b1239b2..167634acce56 100644 --- a/src/libs/Accessibility/index.ts +++ b/src/libs/Accessibility/index.ts @@ -1,5 +1,6 @@ import {useCallback, useEffect, useState} from 'react'; -import {AccessibilityInfo, LayoutChangeEvent} from 'react-native'; +import type {LayoutChangeEvent} from 'react-native'; +import {AccessibilityInfo} from 'react-native'; import moveAccessibilityFocus from './moveAccessibilityFocus'; type HitSlop = {x: number; y: number}; diff --git a/src/libs/Accessibility/moveAccessibilityFocus/index.native.ts b/src/libs/Accessibility/moveAccessibilityFocus/index.native.ts index 2e027c59be39..71c249cf1d10 100644 --- a/src/libs/Accessibility/moveAccessibilityFocus/index.native.ts +++ b/src/libs/Accessibility/moveAccessibilityFocus/index.native.ts @@ -1,5 +1,5 @@ import {AccessibilityInfo} from 'react-native'; -import MoveAccessibilityFocus from './types'; +import type MoveAccessibilityFocus from './types'; const moveAccessibilityFocus: MoveAccessibilityFocus = (ref) => { if (!ref) { diff --git a/src/libs/Accessibility/moveAccessibilityFocus/index.ts b/src/libs/Accessibility/moveAccessibilityFocus/index.ts index b381c1d814c1..cafe1a216db3 100644 --- a/src/libs/Accessibility/moveAccessibilityFocus/index.ts +++ b/src/libs/Accessibility/moveAccessibilityFocus/index.ts @@ -1,4 +1,4 @@ -import MoveAccessibilityFocus from './types'; +import type MoveAccessibilityFocus from './types'; const moveAccessibilityFocus: MoveAccessibilityFocus = (ref) => { if (!ref?.current) { diff --git a/src/libs/Accessibility/moveAccessibilityFocus/types.ts b/src/libs/Accessibility/moveAccessibilityFocus/types.ts index 1344c3f98e3e..6756bdd6f773 100644 --- a/src/libs/Accessibility/moveAccessibilityFocus/types.ts +++ b/src/libs/Accessibility/moveAccessibilityFocus/types.ts @@ -1,5 +1,5 @@ -import {ElementRef, RefObject} from 'react'; -import {HostComponent} from 'react-native'; +import type {ElementRef, RefObject} from 'react'; +import type {HostComponent} from 'react-native'; type MoveAccessibilityFocus = (ref?: ElementRef> & RefObject) => void; diff --git a/src/libs/ActiveClientManager/index.native.ts b/src/libs/ActiveClientManager/index.native.ts index 866992bcc841..7de57a10e5f1 100644 --- a/src/libs/ActiveClientManager/index.native.ts +++ b/src/libs/ActiveClientManager/index.native.ts @@ -2,7 +2,7 @@ * For native devices, there will never be more than one * client running at a time, so this lib is a big no-op */ -import {Init, IsClientTheLeader, IsReady} from './types'; +import type {Init, IsClientTheLeader, IsReady} from './types'; const init: Init = () => {}; diff --git a/src/libs/ActiveClientManager/index.ts b/src/libs/ActiveClientManager/index.ts index 0baeb2becfce..e703ce0458f4 100644 --- a/src/libs/ActiveClientManager/index.ts +++ b/src/libs/ActiveClientManager/index.ts @@ -7,7 +7,7 @@ import Str from 'expensify-common/lib/str'; import Onyx from 'react-native-onyx'; import * as ActiveClients from '@userActions/ActiveClients'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Init, IsClientTheLeader, IsReady} from './types'; +import type {Init, IsClientTheLeader, IsReady} from './types'; const clientID = Str.guid(); const maxClients = 20; diff --git a/src/libs/ApiUtils.ts b/src/libs/ApiUtils.ts index 3d7347136897..67feb18b36fa 100644 --- a/src/libs/ApiUtils.ts +++ b/src/libs/ApiUtils.ts @@ -1,9 +1,9 @@ import Onyx from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Request} from '@src/types/onyx'; +import type {Request} from '@src/types/onyx'; import proxyConfig from '../../config/proxyConfig'; import * as Environment from './Environment/Environment'; diff --git a/src/libs/AppStateMonitor/index.ts b/src/libs/AppStateMonitor/index.ts index f95fad042b98..e89d92b35be4 100644 --- a/src/libs/AppStateMonitor/index.ts +++ b/src/libs/AppStateMonitor/index.ts @@ -1,4 +1,5 @@ -import {AppState, AppStateStatus} from 'react-native'; +import type {AppStateStatus} from 'react-native'; +import {AppState} from 'react-native'; import CONST from '@src/CONST'; import shouldReportActivity from './shouldReportActivity'; diff --git a/src/libs/AppStateMonitor/shouldReportActivity/index.native.ts b/src/libs/AppStateMonitor/shouldReportActivity/index.native.ts index 0e5fdb57a597..36d14308eac7 100644 --- a/src/libs/AppStateMonitor/shouldReportActivity/index.native.ts +++ b/src/libs/AppStateMonitor/shouldReportActivity/index.native.ts @@ -1,4 +1,4 @@ -import ShouldReportActivity from './types'; +import type ShouldReportActivity from './types'; const shouldReportActivity: ShouldReportActivity = true; diff --git a/src/libs/AppStateMonitor/shouldReportActivity/index.ts b/src/libs/AppStateMonitor/shouldReportActivity/index.ts index db326345714e..50704e7b0c80 100644 --- a/src/libs/AppStateMonitor/shouldReportActivity/index.ts +++ b/src/libs/AppStateMonitor/shouldReportActivity/index.ts @@ -1,4 +1,4 @@ -import ShouldReportActivity from './types'; +import type ShouldReportActivity from './types'; // We only need to report when the app becomes active on native since web maintains most of it's network functions while // in the "background" and the concept is not quite the same on mobile. We avoid setting this to true for web since diff --git a/src/libs/Authentication.ts b/src/libs/Authentication.ts index 9962fa55b0af..dd1003591701 100644 --- a/src/libs/Authentication.ts +++ b/src/libs/Authentication.ts @@ -1,6 +1,6 @@ import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; -import Response from '@src/types/onyx/Response'; +import type Response from '@src/types/onyx/Response'; import updateSessionAuthTokens from './actions/Session/updateSessionAuthTokens'; import redirectToSignIn from './actions/SignInRedirect'; import * as ErrorUtils from './ErrorUtils'; diff --git a/src/libs/BootSplash/index.ts b/src/libs/BootSplash/index.ts index 605e65a21a7b..644403d6abc9 100644 --- a/src/libs/BootSplash/index.ts +++ b/src/libs/BootSplash/index.ts @@ -1,5 +1,5 @@ import Log from '@libs/Log'; -import {VisibilityStatus} from './types'; +import type {VisibilityStatus} from './types'; function resolveAfter(delay: number): Promise { return new Promise((resolve) => setTimeout(resolve, delay)); diff --git a/src/libs/CardUtils.ts b/src/libs/CardUtils.ts index 9b2bd2616e8e..d71ad9c2629a 100644 --- a/src/libs/CardUtils.ts +++ b/src/libs/CardUtils.ts @@ -1,9 +1,9 @@ import lodash from 'lodash'; import Onyx from 'react-native-onyx'; import CONST from '@src/CONST'; -import ONYXKEYS, {OnyxValues} from '@src/ONYXKEYS'; -import * as OnyxTypes from '@src/types/onyx'; -import {Card} from '@src/types/onyx'; +import type {OnyxValues} from '@src/ONYXKEYS'; +import ONYXKEYS from '@src/ONYXKEYS'; +import type {Card} from '@src/types/onyx'; import * as Localize from './Localize'; let allCards: OnyxValues[typeof ONYXKEYS.CARD_LIST] = {}; @@ -72,10 +72,10 @@ function getYearFromExpirationDateString(expirationDateString: string) { * @param cardList - collection of assigned cards * @returns collection of assigned cards grouped by domain */ -function getDomainCards(cardList: Record) { +function getDomainCards(cardList: Record) { // Check for domainName to filter out personal credit cards. // eslint-disable-next-line you-dont-need-lodash-underscore/filter - const activeCards = lodash.filter(cardList, (card) => !!card.domainName && (CONST.EXPENSIFY_CARD.ACTIVE_STATES as ReadonlyArray).includes(card.state)); + const activeCards = lodash.filter(cardList, (card) => !!card.domainName && (CONST.EXPENSIFY_CARD.ACTIVE_STATES as ReadonlyArray).includes(card.state)); return lodash.groupBy(activeCards, (card) => card.domainName); } @@ -112,7 +112,7 @@ function findPhysicalCard(cards: Card[]) { * * @param cardList - collection of assigned cards */ -function hasDetectedFraud(cardList: Record): boolean { +function hasDetectedFraud(cardList: Record): boolean { return Object.values(cardList).some((card) => card.fraud !== CONST.EXPENSIFY_CARD.FRAUD_TYPES.NONE); } diff --git a/src/libs/Clipboard/index.native.ts b/src/libs/Clipboard/index.native.ts index f78c5e4ab230..2c345327a106 100644 --- a/src/libs/Clipboard/index.native.ts +++ b/src/libs/Clipboard/index.native.ts @@ -1,5 +1,5 @@ import Clipboard from '@react-native-clipboard/clipboard'; -import {CanSetHtml, SetHtml, SetString} from './types'; +import type {CanSetHtml, SetHtml, SetString} from './types'; /** * Sets a string on the Clipboard object via @react-native-clipboard/clipboard diff --git a/src/libs/Clipboard/index.ts b/src/libs/Clipboard/index.ts index b703b0b4d7f5..512eebce78e2 100644 --- a/src/libs/Clipboard/index.ts +++ b/src/libs/Clipboard/index.ts @@ -1,7 +1,7 @@ import Clipboard from '@react-native-clipboard/clipboard'; import * as Browser from '@libs/Browser'; import CONST from '@src/CONST'; -import {CanSetHtml, SetHtml, SetString} from './types'; +import type {CanSetHtml, SetHtml, SetString} from './types'; type ComposerSelection = { start: number; diff --git a/src/libs/CollectionUtils.ts b/src/libs/CollectionUtils.ts index 3a980906d614..9d0ff5425da2 100644 --- a/src/libs/CollectionUtils.ts +++ b/src/libs/CollectionUtils.ts @@ -1,4 +1,4 @@ -import {OnyxCollectionKey} from '@src/ONYXKEYS'; +import type {OnyxCollectionKey} from '@src/ONYXKEYS'; /** * Return the highest item in a numbered collection diff --git a/src/libs/ComponentUtils/index.native.ts b/src/libs/ComponentUtils/index.native.ts index 096d1449d0e1..5ad39162e1a0 100644 --- a/src/libs/ComponentUtils/index.native.ts +++ b/src/libs/ComponentUtils/index.native.ts @@ -1,4 +1,4 @@ -import {AccessibilityRoleForm, NewPasswordAutocompleteType, PasswordAutocompleteType} from './types'; +import type {AccessibilityRoleForm, NewPasswordAutocompleteType, PasswordAutocompleteType} from './types'; const PASSWORD_AUTOCOMPLETE_TYPE: PasswordAutocompleteType = 'password'; const NEW_PASSWORD_AUTOCOMPLETE_TYPE: NewPasswordAutocompleteType = 'password-new'; diff --git a/src/libs/ComponentUtils/index.ts b/src/libs/ComponentUtils/index.ts index ff8df480aa2c..38abb98594da 100644 --- a/src/libs/ComponentUtils/index.ts +++ b/src/libs/ComponentUtils/index.ts @@ -1,4 +1,4 @@ -import {AccessibilityRoleForm, NewPasswordAutocompleteType, PasswordAutocompleteType} from './types'; +import type {AccessibilityRoleForm, NewPasswordAutocompleteType, PasswordAutocompleteType} from './types'; /** * Web password field needs `current-password` as autocomplete type which is not supported on native diff --git a/src/libs/ComposerUtils/getDraftComment.ts b/src/libs/ComposerUtils/getDraftComment.ts index 97567a42b263..7f11825004a1 100644 --- a/src/libs/ComposerUtils/getDraftComment.ts +++ b/src/libs/ComposerUtils/getDraftComment.ts @@ -1,4 +1,5 @@ -import Onyx, {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; const draftCommentMap: Record> = {}; diff --git a/src/libs/ComposerUtils/getNumberOfLines/index.native.ts b/src/libs/ComposerUtils/getNumberOfLines/index.native.ts index 9a7340b9a035..0cbfb6c7f517 100644 --- a/src/libs/ComposerUtils/getNumberOfLines/index.native.ts +++ b/src/libs/ComposerUtils/getNumberOfLines/index.native.ts @@ -1,4 +1,4 @@ -import GetNumberOfLines from './types'; +import type GetNumberOfLines from './types'; /** * Get the current number of lines in the composer diff --git a/src/libs/ComposerUtils/getNumberOfLines/index.ts b/src/libs/ComposerUtils/getNumberOfLines/index.ts index cf85b45443d5..e80744d41c69 100644 --- a/src/libs/ComposerUtils/getNumberOfLines/index.ts +++ b/src/libs/ComposerUtils/getNumberOfLines/index.ts @@ -1,4 +1,4 @@ -import GetNumberOfLines from './types'; +import type GetNumberOfLines from './types'; /** * Get the current number of lines in the composer diff --git a/src/libs/ComposerUtils/updateIsFullComposerAvailable.ts b/src/libs/ComposerUtils/updateIsFullComposerAvailable.ts index 64c526484760..580908fc3805 100644 --- a/src/libs/ComposerUtils/updateIsFullComposerAvailable.ts +++ b/src/libs/ComposerUtils/updateIsFullComposerAvailable.ts @@ -1,4 +1,4 @@ -import {ComposerProps} from '@components/Composer/types'; +import type {ComposerProps} from '@components/Composer/types'; import CONST from '@src/CONST'; /** diff --git a/src/libs/ComposerUtils/updateNumberOfLines/index.native.ts b/src/libs/ComposerUtils/updateNumberOfLines/index.native.ts index 6f87edaf2475..5a7676d8bfbd 100644 --- a/src/libs/ComposerUtils/updateNumberOfLines/index.native.ts +++ b/src/libs/ComposerUtils/updateNumberOfLines/index.native.ts @@ -1,6 +1,6 @@ import getNumberOfLines from '@libs/ComposerUtils/getNumberOfLines'; import updateIsFullComposerAvailable from '@libs/ComposerUtils/updateIsFullComposerAvailable'; -import UpdateNumberOfLines from './types'; +import type UpdateNumberOfLines from './types'; /** * Check the current scrollHeight of the textarea (minus any padding) and diff --git a/src/libs/ComposerUtils/updateNumberOfLines/index.ts b/src/libs/ComposerUtils/updateNumberOfLines/index.ts index 91a9c9c0f102..3037fb99c8b1 100644 --- a/src/libs/ComposerUtils/updateNumberOfLines/index.ts +++ b/src/libs/ComposerUtils/updateNumberOfLines/index.ts @@ -1,4 +1,4 @@ -import UpdateNumberOfLines from './types'; +import type UpdateNumberOfLines from './types'; const updateNumberOfLines: UpdateNumberOfLines = () => {}; diff --git a/src/libs/ComposerUtils/updateNumberOfLines/types.ts b/src/libs/ComposerUtils/updateNumberOfLines/types.ts index 2fe1465fa194..06daee56a707 100644 --- a/src/libs/ComposerUtils/updateNumberOfLines/types.ts +++ b/src/libs/ComposerUtils/updateNumberOfLines/types.ts @@ -1,6 +1,6 @@ -import {NativeSyntheticEvent, TextInputContentSizeChangeEventData} from 'react-native'; -import {ComposerProps} from '@components/Composer/types'; -import {type ThemeStyles} from '@styles/index'; +import type {NativeSyntheticEvent, TextInputContentSizeChangeEventData} from 'react-native'; +import type {ComposerProps} from '@components/Composer/types'; +import type {ThemeStyles} from '@styles/index'; type UpdateNumberOfLines = (props: ComposerProps, event: NativeSyntheticEvent, styles: ThemeStyles) => void; diff --git a/src/libs/ControlSelection/index.native.ts b/src/libs/ControlSelection/index.native.ts index e9a1e4e9ad5b..b45af6da6441 100644 --- a/src/libs/ControlSelection/index.native.ts +++ b/src/libs/ControlSelection/index.native.ts @@ -1,4 +1,4 @@ -import ControlSelectionModule from './types'; +import type ControlSelectionModule from './types'; function block() {} function unblock() {} diff --git a/src/libs/ControlSelection/index.ts b/src/libs/ControlSelection/index.ts index 44d4530bc4fd..ab11e66bc369 100644 --- a/src/libs/ControlSelection/index.ts +++ b/src/libs/ControlSelection/index.ts @@ -1,5 +1,5 @@ -import CustomRefObject from '@src/types/utils/CustomRefObject'; -import ControlSelectionModule from './types'; +import type CustomRefObject from '@src/types/utils/CustomRefObject'; +import type ControlSelectionModule from './types'; /** * Block selection on the whole app diff --git a/src/libs/ControlSelection/types.ts b/src/libs/ControlSelection/types.ts index d84347fd7ba6..fc0b488577ec 100644 --- a/src/libs/ControlSelection/types.ts +++ b/src/libs/ControlSelection/types.ts @@ -1,4 +1,4 @@ -import CustomRefObject from '@src/types/utils/CustomRefObject'; +import type CustomRefObject from '@src/types/utils/CustomRefObject'; type ControlSelectionModule = { block: () => void; diff --git a/src/libs/CurrencyUtils.ts b/src/libs/CurrencyUtils.ts index b8f5b434cc4a..42387e03c80b 100644 --- a/src/libs/CurrencyUtils.ts +++ b/src/libs/CurrencyUtils.ts @@ -1,6 +1,7 @@ import Onyx from 'react-native-onyx'; import CONST from '@src/CONST'; -import ONYXKEYS, {OnyxValues} from '@src/ONYXKEYS'; +import type {OnyxValues} from '@src/ONYXKEYS'; +import ONYXKEYS from '@src/ONYXKEYS'; import * as Localize from './Localize'; import BaseLocaleListener from './Localize/LocaleListener/BaseLocaleListener'; import * as NumberFormatUtils from './NumberFormatUtils'; diff --git a/src/libs/DateUtils.ts b/src/libs/DateUtils.ts index 4bd717eba6c0..08f61a50b645 100644 --- a/src/libs/DateUtils.ts +++ b/src/libs/DateUtils.ts @@ -27,10 +27,10 @@ import {formatInTimeZone, format as tzFormat, utcToZonedTime, zonedTimeToUtc} fr import {enGB, es} from 'date-fns/locale'; import throttle from 'lodash/throttle'; import Onyx from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {SelectedTimezone, Timezone} from '@src/types/onyx/PersonalDetails'; +import type {SelectedTimezone, Timezone} from '@src/types/onyx/PersonalDetails'; import * as CurrentDate from './actions/CurrentDate'; import * as Localize from './Localize'; import Log from './Log'; diff --git a/src/libs/DeviceCapabilities/canUseTouchScreen/index.native.ts b/src/libs/DeviceCapabilities/canUseTouchScreen/index.native.ts index 60980801e73c..d8d04a8cbeb7 100644 --- a/src/libs/DeviceCapabilities/canUseTouchScreen/index.native.ts +++ b/src/libs/DeviceCapabilities/canUseTouchScreen/index.native.ts @@ -1,4 +1,4 @@ -import CanUseTouchScreen from './types'; +import type CanUseTouchScreen from './types'; const canUseTouchScreen: CanUseTouchScreen = () => true; diff --git a/src/libs/DeviceCapabilities/canUseTouchScreen/index.ts b/src/libs/DeviceCapabilities/canUseTouchScreen/index.ts index 9e21f5a42b5d..34a1fc532e9e 100644 --- a/src/libs/DeviceCapabilities/canUseTouchScreen/index.ts +++ b/src/libs/DeviceCapabilities/canUseTouchScreen/index.ts @@ -1,5 +1,5 @@ -import {Merge} from 'type-fest'; -import CanUseTouchScreen from './types'; +import type {Merge} from 'type-fest'; +import type CanUseTouchScreen from './types'; type ExtendedNavigator = Merge; diff --git a/src/libs/DeviceCapabilities/hasHoverSupport/index.native.ts b/src/libs/DeviceCapabilities/hasHoverSupport/index.native.ts index 097b3b0cbba1..31277f753923 100644 --- a/src/libs/DeviceCapabilities/hasHoverSupport/index.native.ts +++ b/src/libs/DeviceCapabilities/hasHoverSupport/index.native.ts @@ -1,4 +1,4 @@ -import HasHoverSupport from './types'; +import type HasHoverSupport from './types'; /** * Allows us to identify whether the platform is hoverable. diff --git a/src/libs/DeviceCapabilities/hasHoverSupport/index.ts b/src/libs/DeviceCapabilities/hasHoverSupport/index.ts index 1ff0f461db69..4915c7786532 100644 --- a/src/libs/DeviceCapabilities/hasHoverSupport/index.ts +++ b/src/libs/DeviceCapabilities/hasHoverSupport/index.ts @@ -1,4 +1,4 @@ -import HasHoverSupport from './types'; +import type HasHoverSupport from './types'; /** * Allows us to identify whether the platform is hoverable. diff --git a/src/libs/DeviceCapabilities/hasPassiveEventListenerSupport/index.native.ts b/src/libs/DeviceCapabilities/hasPassiveEventListenerSupport/index.native.ts index a5e57675fcf5..f32cff6b365d 100644 --- a/src/libs/DeviceCapabilities/hasPassiveEventListenerSupport/index.native.ts +++ b/src/libs/DeviceCapabilities/hasPassiveEventListenerSupport/index.native.ts @@ -1,4 +1,4 @@ -import HasPassiveEventListenerSupport from './types'; +import type HasPassiveEventListenerSupport from './types'; /** * Allows us to identify whether the browser supports passive event listener. diff --git a/src/libs/DistanceRequestUtils.ts b/src/libs/DistanceRequestUtils.ts index 477bfb4b61f9..790a9b1e37cd 100644 --- a/src/libs/DistanceRequestUtils.ts +++ b/src/libs/DistanceRequestUtils.ts @@ -1,7 +1,8 @@ -import {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; import type {LocaleContextProps} from '@components/LocaleContextProvider'; import CONST from '@src/CONST'; -import Policy, {Unit} from '@src/types/onyx/Policy'; +import type {Unit} from '@src/types/onyx/Policy'; +import type Policy from '@src/types/onyx/Policy'; import * as CurrencyUtils from './CurrencyUtils'; import * as PolicyUtils from './PolicyUtils'; diff --git a/src/libs/DomUtils/index.native.ts b/src/libs/DomUtils/index.native.ts index 0864f1a16ac0..7117f5942f9a 100644 --- a/src/libs/DomUtils/index.native.ts +++ b/src/libs/DomUtils/index.native.ts @@ -1,4 +1,4 @@ -import GetActiveElement from './types'; +import type GetActiveElement from './types'; const getActiveElement: GetActiveElement = () => null; diff --git a/src/libs/DomUtils/index.ts b/src/libs/DomUtils/index.ts index 6a2eed57fbe6..068eb0c9fe7e 100644 --- a/src/libs/DomUtils/index.ts +++ b/src/libs/DomUtils/index.ts @@ -1,4 +1,4 @@ -import GetActiveElement from './types'; +import type GetActiveElement from './types'; const getActiveElement: GetActiveElement = () => document.activeElement; diff --git a/src/libs/E2E/API.mock.ts b/src/libs/E2E/API.mock.ts index 0568de926024..83b7cb218977 100644 --- a/src/libs/E2E/API.mock.ts +++ b/src/libs/E2E/API.mock.ts @@ -1,6 +1,6 @@ import Onyx from 'react-native-onyx'; import Log from '@libs/Log'; -import Response from '@src/types/onyx/Response'; +import type Response from '@src/types/onyx/Response'; // mock functions import mockAuthenticatePusher from './apiMocks/authenticatePusher'; import mockBeginSignin from './apiMocks/beginSignin'; diff --git a/src/libs/E2E/apiMocks/authenticatePusher.ts b/src/libs/E2E/apiMocks/authenticatePusher.ts index 81191ddb8222..28f9ebbbee88 100644 --- a/src/libs/E2E/apiMocks/authenticatePusher.ts +++ b/src/libs/E2E/apiMocks/authenticatePusher.ts @@ -1,4 +1,4 @@ -import Response from '@src/types/onyx/Response'; +import type Response from '@src/types/onyx/Response'; const authenticatePusher = (): Response => ({ auth: 'auth', diff --git a/src/libs/E2E/apiMocks/beginSignin.ts b/src/libs/E2E/apiMocks/beginSignin.ts index c5002f1f3dd8..a578f935c2aa 100644 --- a/src/libs/E2E/apiMocks/beginSignin.ts +++ b/src/libs/E2E/apiMocks/beginSignin.ts @@ -1,5 +1,5 @@ -import {SigninParams} from '@libs/E2E/types'; -import Response from '@src/types/onyx/Response'; +import type {SigninParams} from '@libs/E2E/types'; +import type Response from '@src/types/onyx/Response'; const beginSignin = ({email}: SigninParams): Response => ({ onyxData: [ diff --git a/src/libs/E2E/apiMocks/openApp.ts b/src/libs/E2E/apiMocks/openApp.ts index 42d13716407d..ec714d693666 100644 --- a/src/libs/E2E/apiMocks/openApp.ts +++ b/src/libs/E2E/apiMocks/openApp.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import Response from '@src/types/onyx/Response'; +import type Response from '@src/types/onyx/Response'; const openApp = (): Response => ({ onyxData: [ diff --git a/src/libs/E2E/apiMocks/openReport.ts b/src/libs/E2E/apiMocks/openReport.ts index 51d40dc896d2..49d44605592d 100644 --- a/src/libs/E2E/apiMocks/openReport.ts +++ b/src/libs/E2E/apiMocks/openReport.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import Response from '@src/types/onyx/Response'; +import type Response from '@src/types/onyx/Response'; export default (): Response => ({ onyxData: [ diff --git a/src/libs/E2E/apiMocks/readNewestAction.ts b/src/libs/E2E/apiMocks/readNewestAction.ts index 5db007e64a6f..eb3800a98b81 100644 --- a/src/libs/E2E/apiMocks/readNewestAction.ts +++ b/src/libs/E2E/apiMocks/readNewestAction.ts @@ -1,4 +1,4 @@ -import Response from '@src/types/onyx/Response'; +import type Response from '@src/types/onyx/Response'; export default (): Response => ({ jsonCode: 200, diff --git a/src/libs/E2E/apiMocks/signinUser.ts b/src/libs/E2E/apiMocks/signinUser.ts index a7d841196c48..7063e56f94be 100644 --- a/src/libs/E2E/apiMocks/signinUser.ts +++ b/src/libs/E2E/apiMocks/signinUser.ts @@ -1,5 +1,5 @@ -import {SigninParams} from '@libs/E2E/types'; -import Response from '@src/types/onyx/Response'; +import type {SigninParams} from '@libs/E2E/types'; +import type Response from '@src/types/onyx/Response'; const signinUser = ({email}: SigninParams): Response => ({ onyxData: [ diff --git a/src/libs/E2E/isE2ETestSession.native.ts b/src/libs/E2E/isE2ETestSession.native.ts index 0463d41572cf..249062289e43 100644 --- a/src/libs/E2E/isE2ETestSession.native.ts +++ b/src/libs/E2E/isE2ETestSession.native.ts @@ -1,5 +1,5 @@ import CONFIG from '@src/CONFIG'; -import {IsE2ETestSession} from './types'; +import type {IsE2ETestSession} from './types'; const isE2ETestSession: IsE2ETestSession = () => CONFIG.E2E_TESTING; diff --git a/src/libs/E2E/isE2ETestSession.ts b/src/libs/E2E/isE2ETestSession.ts index 145c4336fddf..cba31689f951 100644 --- a/src/libs/E2E/isE2ETestSession.ts +++ b/src/libs/E2E/isE2ETestSession.ts @@ -1,4 +1,4 @@ -import {IsE2ETestSession} from './types'; +import type {IsE2ETestSession} from './types'; const isE2ETestSession: IsE2ETestSession = () => false; diff --git a/src/libs/E2E/reactNativeLaunchingTest.ts b/src/libs/E2E/reactNativeLaunchingTest.ts index 0533a2ff600b..cbd63270e736 100644 --- a/src/libs/E2E/reactNativeLaunchingTest.ts +++ b/src/libs/E2E/reactNativeLaunchingTest.ts @@ -5,7 +5,7 @@ * By doing this, we avoid bundling any E2E testing code * into the actual release app. */ -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import * as Metrics from '@libs/Metrics'; import Performance from '@libs/Performance'; import E2EConfig from '../../../tests/e2e/config'; diff --git a/src/libs/E2E/tests/appStartTimeTest.e2e.ts b/src/libs/E2E/tests/appStartTimeTest.e2e.ts index 92e2513e0351..6589e594dac6 100644 --- a/src/libs/E2E/tests/appStartTimeTest.e2e.ts +++ b/src/libs/E2E/tests/appStartTimeTest.e2e.ts @@ -1,5 +1,5 @@ import Config from 'react-native-config'; -import {PerformanceEntry} from 'react-native-performance'; +import type {PerformanceEntry} from 'react-native-performance'; import E2ELogin from '@libs/E2E/actions/e2eLogin'; import E2EClient from '@libs/E2E/client'; import Performance from '@libs/Performance'; diff --git a/src/libs/EmojiTrie.ts b/src/libs/EmojiTrie.ts index 0100f279066a..4c441facdd46 100644 --- a/src/libs/EmojiTrie.ts +++ b/src/libs/EmojiTrie.ts @@ -1,6 +1,6 @@ import emojis, {localeEmojis} from '@assets/emojis'; import CONST from '@src/CONST'; -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; import Timing from './actions/Timing'; import Trie from './Trie'; diff --git a/src/libs/EmojiUtils.ts b/src/libs/EmojiUtils.ts index baff8ea7087f..06bbd5c871ed 100644 --- a/src/libs/EmojiUtils.ts +++ b/src/libs/EmojiUtils.ts @@ -3,13 +3,13 @@ import Str from 'expensify-common/lib/str'; import memoize from 'lodash/memoize'; import Onyx from 'react-native-onyx'; import * as Emojis from '@assets/emojis'; -import {Emoji, HeaderEmoji, PickerEmojis} from '@assets/emojis/types'; +import type {Emoji, HeaderEmoji, PickerEmojis} from '@assets/emojis/types'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {FrequentlyUsedEmoji} from '@src/types/onyx'; -import {ReportActionReaction, UsersReactions} from '@src/types/onyx/ReportActionReactions'; -import IconAsset from '@src/types/utils/IconAsset'; -import {SupportedLanguage} from './EmojiTrie'; +import type {FrequentlyUsedEmoji} from '@src/types/onyx'; +import type {ReportActionReaction, UsersReactions} from '@src/types/onyx/ReportActionReactions'; +import type IconAsset from '@src/types/utils/IconAsset'; +import type {SupportedLanguage} from './EmojiTrie'; type HeaderIndice = {code: string; index: number; icon: IconAsset}; type EmojiSpacer = {code: string; spacer: boolean}; diff --git a/src/libs/Environment/betaChecker/index.android.ts b/src/libs/Environment/betaChecker/index.android.ts index f230120ba0b1..aeb1527457f7 100644 --- a/src/libs/Environment/betaChecker/index.android.ts +++ b/src/libs/Environment/betaChecker/index.android.ts @@ -4,7 +4,7 @@ import * as AppUpdate from '@userActions/AppUpdate'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import pkg from '../../../../package.json'; -import IsBetaBuild from './types'; +import type IsBetaBuild from './types'; let isLastSavedBeta = false; Onyx.connect({ diff --git a/src/libs/Environment/betaChecker/index.ios.ts b/src/libs/Environment/betaChecker/index.ios.ts index 0d901fc4b003..dae79dabfd2b 100644 --- a/src/libs/Environment/betaChecker/index.ios.ts +++ b/src/libs/Environment/betaChecker/index.ios.ts @@ -1,5 +1,5 @@ import {NativeModules} from 'react-native'; -import IsBetaBuild from './types'; +import type IsBetaBuild from './types'; /** * Check to see if the build is staging (TestFlight) or production diff --git a/src/libs/Environment/betaChecker/index.ts b/src/libs/Environment/betaChecker/index.ts index 541a3120ccce..ce1668759c8c 100644 --- a/src/libs/Environment/betaChecker/index.ts +++ b/src/libs/Environment/betaChecker/index.ts @@ -1,4 +1,4 @@ -import IsBetaBuild from './types'; +import type IsBetaBuild from './types'; /** * There's no beta build in non native diff --git a/src/libs/Environment/getEnvironment/index.native.ts b/src/libs/Environment/getEnvironment/index.native.ts index 766f288376b5..fb3f70001aaa 100644 --- a/src/libs/Environment/getEnvironment/index.native.ts +++ b/src/libs/Environment/getEnvironment/index.native.ts @@ -1,7 +1,7 @@ import Config from 'react-native-config'; import betaChecker from '@libs/Environment/betaChecker'; import CONST from '@src/CONST'; -import Environment from './types'; +import type Environment from './types'; let environment: Environment | null = null; diff --git a/src/libs/Environment/getEnvironment/index.ts b/src/libs/Environment/getEnvironment/index.ts index 84f64e91649b..9bcefba880a4 100644 --- a/src/libs/Environment/getEnvironment/index.ts +++ b/src/libs/Environment/getEnvironment/index.ts @@ -1,6 +1,6 @@ import Config from 'react-native-config'; import CONST from '@src/CONST'; -import Environment from './types'; +import type Environment from './types'; function getEnvironment(): Promise { return Promise.resolve((Config?.ENVIRONMENT as Environment) ?? CONST.ENVIRONMENT.DEV); diff --git a/src/libs/Environment/getEnvironment/types.ts b/src/libs/Environment/getEnvironment/types.ts index 9247ed17ffe2..6f8cf505d2f3 100644 --- a/src/libs/Environment/getEnvironment/types.ts +++ b/src/libs/Environment/getEnvironment/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; type Environment = ValueOf; diff --git a/src/libs/ErrorUtils.ts b/src/libs/ErrorUtils.ts index 46bdd510f5c4..159a5817189b 100644 --- a/src/libs/ErrorUtils.ts +++ b/src/libs/ErrorUtils.ts @@ -1,7 +1,7 @@ import CONST from '@src/CONST'; -import {TranslationFlatObject, TranslationPaths} from '@src/languages/types'; -import {ErrorFields, Errors} from '@src/types/onyx/OnyxCommon'; -import Response from '@src/types/onyx/Response'; +import type {TranslationFlatObject, TranslationPaths} from '@src/languages/types'; +import type {ErrorFields, Errors} from '@src/types/onyx/OnyxCommon'; +import type Response from '@src/types/onyx/Response'; import DateUtils from './DateUtils'; import * as Localize from './Localize'; diff --git a/src/libs/Firebase/index.native.ts b/src/libs/Firebase/index.native.ts index 107b3f8905b3..bf8551954671 100644 --- a/src/libs/Firebase/index.native.ts +++ b/src/libs/Firebase/index.native.ts @@ -1,7 +1,7 @@ /* eslint-disable no-unused-vars */ import perf from '@react-native-firebase/perf'; import * as Environment from '@libs/Environment/Environment'; -import {StartTrace, StopTrace, TraceMap} from './types'; +import type {StartTrace, StopTrace, TraceMap} from './types'; const traceMap: TraceMap = {}; diff --git a/src/libs/Firebase/index.ts b/src/libs/Firebase/index.ts index 3048cf1d9bd8..8698a841db4a 100644 --- a/src/libs/Firebase/index.ts +++ b/src/libs/Firebase/index.ts @@ -1,4 +1,4 @@ -import {StartTrace, StopTrace} from './types'; +import type {StartTrace, StopTrace} from './types'; /** Web does not use Firebase for performance tracing */ const startTrace: StartTrace = () => {}; diff --git a/src/libs/Firebase/types.ts b/src/libs/Firebase/types.ts index 3822f7072a7f..1a1d4959740a 100644 --- a/src/libs/Firebase/types.ts +++ b/src/libs/Firebase/types.ts @@ -1,4 +1,4 @@ -import {FirebasePerformanceTypes} from '@react-native-firebase/perf'; +import type {FirebasePerformanceTypes} from '@react-native-firebase/perf'; type Trace = { trace: FirebasePerformanceTypes.Trace; diff --git a/src/libs/FormUtils.ts b/src/libs/FormUtils.ts index facaf5bfddf4..5366e149728e 100644 --- a/src/libs/FormUtils.ts +++ b/src/libs/FormUtils.ts @@ -1,4 +1,4 @@ -import {OnyxFormKey} from '@src/ONYXKEYS'; +import type {OnyxFormKey} from '@src/ONYXKEYS'; type ExcludeDraft = T extends `${string}Draft` ? never : T; type OnyxFormKeyWithoutDraft = ExcludeDraft; diff --git a/src/libs/GetPhysicalCardUtils.ts b/src/libs/GetPhysicalCardUtils.ts index 9d77858cb2a9..eebefd7c1d52 100644 --- a/src/libs/GetPhysicalCardUtils.ts +++ b/src/libs/GetPhysicalCardUtils.ts @@ -1,5 +1,5 @@ import ROUTES from '@src/ROUTES'; -import {Login} from '@src/types/onyx'; +import type {Login} from '@src/types/onyx'; import Navigation from './Navigation/Navigation'; import * as PersonalDetailsUtils from './PersonalDetailsUtils'; import * as UserUtils from './UserUtils'; diff --git a/src/libs/GroupChatUtils.ts b/src/libs/GroupChatUtils.ts index 862c50700c0c..ba14bc9c9c3d 100644 --- a/src/libs/GroupChatUtils.ts +++ b/src/libs/GroupChatUtils.ts @@ -1,6 +1,7 @@ -import Onyx, {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; -import {PersonalDetailsList, Report} from '@src/types/onyx'; +import type {PersonalDetailsList, Report} from '@src/types/onyx'; import * as OptionsListUtils from './OptionsListUtils'; import * as ReportUtils from './ReportUtils'; diff --git a/src/libs/HapticFeedback/index.native.ts b/src/libs/HapticFeedback/index.native.ts index 4c3605cc27ef..6d24ece3951c 100644 --- a/src/libs/HapticFeedback/index.native.ts +++ b/src/libs/HapticFeedback/index.native.ts @@ -1,5 +1,5 @@ import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; -import HapticFeedback from './types'; +import type HapticFeedback from './types'; const hapticFeedback: HapticFeedback = { press: () => { diff --git a/src/libs/HapticFeedback/index.ts b/src/libs/HapticFeedback/index.ts index 3dd5b87f573b..7a006b42cab4 100644 --- a/src/libs/HapticFeedback/index.ts +++ b/src/libs/HapticFeedback/index.ts @@ -1,4 +1,4 @@ -import HapticFeedback from './types'; +import type HapticFeedback from './types'; /** * Web does not support Haptic feedback diff --git a/src/libs/HeaderUtils.ts b/src/libs/HeaderUtils.ts index ebf1b1139621..a1822aca00f4 100644 --- a/src/libs/HeaderUtils.ts +++ b/src/libs/HeaderUtils.ts @@ -1,7 +1,7 @@ -import {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; import * as Expensicons from '@components/Icon/Expensicons'; -import OnyxReport from '@src/types/onyx/Report'; -import IconAsset from '@src/types/utils/IconAsset'; +import type OnyxReport from '@src/types/onyx/Report'; +import type IconAsset from '@src/types/utils/IconAsset'; import * as Report from './actions/Report'; import * as Session from './actions/Session'; import * as Localize from './Localize'; diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index 859c8624833c..e40c8148c923 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -1,9 +1,9 @@ import Onyx from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import alert from '@components/Alert'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {RequestType} from '@src/types/onyx/Request'; +import type {RequestType} from '@src/types/onyx/Request'; import type Response from '@src/types/onyx/Response'; import * as ApiUtils from './ApiUtils'; import HttpsError from './Errors/HttpsError'; diff --git a/src/libs/IOUUtils.ts b/src/libs/IOUUtils.ts index edfb9e3691d0..09cdfd15cbba 100644 --- a/src/libs/IOUUtils.ts +++ b/src/libs/IOUUtils.ts @@ -1,8 +1,8 @@ -import {OnyxEntry} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {OnyxEntry} from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; -import {Report, Transaction} from '@src/types/onyx'; +import type {Report, Transaction} from '@src/types/onyx'; import * as CurrencyUtils from './CurrencyUtils'; import * as FileUtils from './fileDownload/FileUtils'; import Navigation from './Navigation/Navigation'; diff --git a/src/libs/IntlPolyfill/index.native.ts b/src/libs/IntlPolyfill/index.native.ts index a044b4c52f0d..0819479b50ec 100644 --- a/src/libs/IntlPolyfill/index.native.ts +++ b/src/libs/IntlPolyfill/index.native.ts @@ -1,6 +1,6 @@ import polyfillListFormat from './polyfillListFormat'; import polyfillNumberFormat from './polyfillNumberFormat'; -import IntlPolyfill from './types'; +import type IntlPolyfill from './types'; /** * Polyfill the Intl API, always performed for native devices. diff --git a/src/libs/IntlPolyfill/index.ts b/src/libs/IntlPolyfill/index.ts index bef12ef093e2..42664477409f 100644 --- a/src/libs/IntlPolyfill/index.ts +++ b/src/libs/IntlPolyfill/index.ts @@ -1,5 +1,5 @@ import polyfillNumberFormat from './polyfillNumberFormat'; -import IntlPolyfill from './types'; +import type IntlPolyfill from './types'; /** * Polyfill the Intl API if the ICU version is old. diff --git a/src/libs/KeyboardShortcut/KeyDownPressListener/index.native.ts b/src/libs/KeyboardShortcut/KeyDownPressListener/index.native.ts index 8b460a069f05..e506a97890c0 100644 --- a/src/libs/KeyboardShortcut/KeyDownPressListener/index.native.ts +++ b/src/libs/KeyboardShortcut/KeyDownPressListener/index.native.ts @@ -1,4 +1,4 @@ -import {AddKeyDownPressListener, RemoveKeyDownPressListener} from './types'; +import type {AddKeyDownPressListener, RemoveKeyDownPressListener} from './types'; const addKeyDownPressListener: AddKeyDownPressListener = () => {}; const removeKeyDownPressListener: RemoveKeyDownPressListener = () => {}; diff --git a/src/libs/KeyboardShortcut/bindHandlerToKeydownEvent/index.native.ts b/src/libs/KeyboardShortcut/bindHandlerToKeydownEvent/index.native.ts index 4deabb9aa5ef..bc56df0d67f3 100644 --- a/src/libs/KeyboardShortcut/bindHandlerToKeydownEvent/index.native.ts +++ b/src/libs/KeyboardShortcut/bindHandlerToKeydownEvent/index.native.ts @@ -1,5 +1,5 @@ import getKeyEventModifiers from '@libs/KeyboardShortcut/getKeyEventModifiers'; -import BindHandlerToKeydownEvent from './types'; +import type BindHandlerToKeydownEvent from './types'; /** * Checks if an event for that key is configured and if so, runs it. diff --git a/src/libs/KeyboardShortcut/bindHandlerToKeydownEvent/index.ts b/src/libs/KeyboardShortcut/bindHandlerToKeydownEvent/index.ts index f8e18a11971d..dd0aedcb5dbd 100644 --- a/src/libs/KeyboardShortcut/bindHandlerToKeydownEvent/index.ts +++ b/src/libs/KeyboardShortcut/bindHandlerToKeydownEvent/index.ts @@ -1,6 +1,6 @@ import getKeyEventModifiers from '@libs/KeyboardShortcut/getKeyEventModifiers'; import isEnterWhileComposition from '@libs/KeyboardShortcut/isEnterWhileComposition'; -import BindHandlerToKeydownEvent from './types'; +import type BindHandlerToKeydownEvent from './types'; /** * Checks if an event for that key is configured and if so, runs it. diff --git a/src/libs/KeyboardShortcut/getKeyEventModifiers.ts b/src/libs/KeyboardShortcut/getKeyEventModifiers.ts index f82de725bb50..d6fbf80bc5bf 100644 --- a/src/libs/KeyboardShortcut/getKeyEventModifiers.ts +++ b/src/libs/KeyboardShortcut/getKeyEventModifiers.ts @@ -1,5 +1,5 @@ import * as KeyCommand from 'react-native-key-command'; -import {KeyCommandEvent} from './bindHandlerToKeydownEvent/types'; +import type {KeyCommandEvent} from './bindHandlerToKeydownEvent/types'; const keyModifierControl = KeyCommand?.constants.keyModifierControl ?? 'keyModifierControl'; const keyModifierCommand = KeyCommand?.constants.keyModifierCommand ?? 'keyModifierCommand'; diff --git a/src/libs/KeyboardShortcut/isEnterWhileComposition.ts b/src/libs/KeyboardShortcut/isEnterWhileComposition.ts index a752f8a24811..71ec27f21c13 100644 --- a/src/libs/KeyboardShortcut/isEnterWhileComposition.ts +++ b/src/libs/KeyboardShortcut/isEnterWhileComposition.ts @@ -1,5 +1,5 @@ -import React from 'react'; -import {NativeSyntheticEvent} from 'react-native'; +import type React from 'react'; +import type {NativeSyntheticEvent} from 'react-native'; import * as Browser from '@libs/Browser'; import CONST from '@src/CONST'; diff --git a/src/libs/LocaleDigitUtils.ts b/src/libs/LocaleDigitUtils.ts index 05d9fea5357d..794c7611cb5c 100644 --- a/src/libs/LocaleDigitUtils.ts +++ b/src/libs/LocaleDigitUtils.ts @@ -1,6 +1,6 @@ import _ from 'lodash'; -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; import * as NumberFormatUtils from './NumberFormatUtils'; type Locale = ValueOf; diff --git a/src/libs/Localize/LocaleListener/BaseLocaleListener.ts b/src/libs/Localize/LocaleListener/BaseLocaleListener.ts index c5eba18af422..79422fa82c21 100644 --- a/src/libs/Localize/LocaleListener/BaseLocaleListener.ts +++ b/src/libs/Localize/LocaleListener/BaseLocaleListener.ts @@ -1,7 +1,8 @@ import Onyx from 'react-native-onyx'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import BaseLocale, {LocaleListenerConnect} from './types'; +import type {LocaleListenerConnect} from './types'; +import type BaseLocale from './types'; let preferredLocale: BaseLocale = CONST.LOCALES.DEFAULT; diff --git a/src/libs/Localize/LocaleListener/index.desktop.ts b/src/libs/Localize/LocaleListener/index.desktop.ts index 6974d3ed4879..db5cbb1a51a6 100644 --- a/src/libs/Localize/LocaleListener/index.desktop.ts +++ b/src/libs/Localize/LocaleListener/index.desktop.ts @@ -1,6 +1,6 @@ import ELECTRON_EVENTS from '../../../../desktop/ELECTRON_EVENTS'; import BaseLocaleListener from './BaseLocaleListener'; -import {LocaleListener, LocaleListenerConnect} from './types'; +import type {LocaleListener, LocaleListenerConnect} from './types'; const localeListenerConnect: LocaleListenerConnect = (callbackAfterChange = () => {}) => BaseLocaleListener.connect((val) => { diff --git a/src/libs/Localize/LocaleListener/index.ts b/src/libs/Localize/LocaleListener/index.ts index b0dda5d5fabc..c08eb129934a 100644 --- a/src/libs/Localize/LocaleListener/index.ts +++ b/src/libs/Localize/LocaleListener/index.ts @@ -1,5 +1,5 @@ import BaseLocaleListener from './BaseLocaleListener'; -import {LocaleListener, LocaleListenerConnect} from './types'; +import type {LocaleListener, LocaleListenerConnect} from './types'; const localeListenerConnect: LocaleListenerConnect = BaseLocaleListener.connect; diff --git a/src/libs/Localize/LocaleListener/types.ts b/src/libs/Localize/LocaleListener/types.ts index 4daf90af0483..453e8c7f442a 100644 --- a/src/libs/Localize/LocaleListener/types.ts +++ b/src/libs/Localize/LocaleListener/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; type BaseLocale = ValueOf; diff --git a/src/libs/Localize/index.ts b/src/libs/Localize/index.ts index 77c34ebdc576..bc40f93dd13b 100644 --- a/src/libs/Localize/index.ts +++ b/src/libs/Localize/index.ts @@ -1,11 +1,11 @@ import * as RNLocalize from 'react-native-localize'; import Onyx from 'react-native-onyx'; import Log from '@libs/Log'; -import {MessageElementBase, MessageTextElement} from '@libs/MessageElement'; +import type {MessageElementBase, MessageTextElement} from '@libs/MessageElement'; import Config from '@src/CONFIG'; import CONST from '@src/CONST'; import translations from '@src/languages/translations'; -import {TranslationFlatObject, TranslationPaths} from '@src/languages/types'; +import type {TranslationFlatObject, TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; import LocaleListener from './LocaleListener'; import BaseLocaleListener from './LocaleListener/BaseLocaleListener'; diff --git a/src/libs/Log.ts b/src/libs/Log.ts index e171e6338ffe..9916cdd23b76 100644 --- a/src/libs/Log.ts +++ b/src/libs/Log.ts @@ -3,7 +3,7 @@ /* eslint-disable rulesdir/no-api-in-views */ import Logger from 'expensify-common/lib/Logger'; -import {Merge} from 'type-fest'; +import type {Merge} from 'type-fest'; import pkg from '../../package.json'; import getPlatform from './getPlatform'; import * as Network from './Network'; diff --git a/src/libs/Metrics/index.native.ts b/src/libs/Metrics/index.native.ts index 373f826e9ca3..a1d008da653b 100644 --- a/src/libs/Metrics/index.native.ts +++ b/src/libs/Metrics/index.native.ts @@ -1,5 +1,5 @@ import CONFIG from '@src/CONFIG'; -import {CanCaptureOnyxMetrics, CanCapturePerformanceMetrics} from './types'; +import type {CanCaptureOnyxMetrics, CanCapturePerformanceMetrics} from './types'; /** * Is capturing performance stats enabled. diff --git a/src/libs/Metrics/index.ts b/src/libs/Metrics/index.ts index 1097826aff24..51248b891d81 100644 --- a/src/libs/Metrics/index.ts +++ b/src/libs/Metrics/index.ts @@ -1,5 +1,5 @@ import CONFIG from '@src/CONFIG'; -import {CanCaptureOnyxMetrics, CanCapturePerformanceMetrics} from './types'; +import type {CanCaptureOnyxMetrics, CanCapturePerformanceMetrics} from './types'; // We don't capture performance metrics on web as there are enough tools available const canCapturePerformanceMetrics: CanCapturePerformanceMetrics = () => false; diff --git a/src/libs/Middleware/HandleUnusedOptimisticID.ts b/src/libs/Middleware/HandleUnusedOptimisticID.ts index abca86522d2b..eb419401d84d 100644 --- a/src/libs/Middleware/HandleUnusedOptimisticID.ts +++ b/src/libs/Middleware/HandleUnusedOptimisticID.ts @@ -1,9 +1,9 @@ import _ from 'lodash'; import deepReplaceKeysAndValues from '@libs/deepReplaceKeysAndValues'; -import {Middleware} from '@libs/Request'; +import type {Middleware} from '@libs/Request'; import * as PersistedRequests from '@userActions/PersistedRequests'; import ONYXKEYS from '@src/ONYXKEYS'; -import Report from '@src/types/onyx/Report'; +import type Report from '@src/types/onyx/Report'; const handleUnusedOptimisticID: Middleware = (requestResponse, request, isFromSequentialQueue) => requestResponse.then((response) => { diff --git a/src/libs/Middleware/Logging.ts b/src/libs/Middleware/Logging.ts index 3ef819298f80..27a904f692ed 100644 --- a/src/libs/Middleware/Logging.ts +++ b/src/libs/Middleware/Logging.ts @@ -1,8 +1,8 @@ import Log from '@libs/Log'; import CONST from '@src/CONST'; -import Request from '@src/types/onyx/Request'; -import Response from '@src/types/onyx/Response'; -import Middleware from './types'; +import type Request from '@src/types/onyx/Request'; +import type Response from '@src/types/onyx/Response'; +import type Middleware from './types'; function logRequestDetails(message: string, request: Request, response?: Response | void) { // Don't log about log or else we'd cause an infinite loop diff --git a/src/libs/Middleware/Reauthentication.ts b/src/libs/Middleware/Reauthentication.ts index f1f71a85b16c..09a01e821cb2 100644 --- a/src/libs/Middleware/Reauthentication.ts +++ b/src/libs/Middleware/Reauthentication.ts @@ -5,7 +5,7 @@ import * as NetworkStore from '@libs/Network/NetworkStore'; import NetworkConnection from '@libs/NetworkConnection'; import * as Request from '@libs/Request'; import CONST from '@src/CONST'; -import Middleware from './types'; +import type Middleware from './types'; // We store a reference to the active authentication request so that we are only ever making one request to authenticate at a time. let isAuthenticating: Promise | null = null; diff --git a/src/libs/Middleware/RecheckConnection.ts b/src/libs/Middleware/RecheckConnection.ts index 1f43b0171800..f3f7d2e7b688 100644 --- a/src/libs/Middleware/RecheckConnection.ts +++ b/src/libs/Middleware/RecheckConnection.ts @@ -1,6 +1,6 @@ import NetworkConnection from '@libs/NetworkConnection'; import CONST from '@src/CONST'; -import Middleware from './types'; +import type Middleware from './types'; /** * @returns cancel timer diff --git a/src/libs/Middleware/SaveResponseInOnyx.ts b/src/libs/Middleware/SaveResponseInOnyx.ts index d73a10d98663..9ed93c4ce393 100644 --- a/src/libs/Middleware/SaveResponseInOnyx.ts +++ b/src/libs/Middleware/SaveResponseInOnyx.ts @@ -2,7 +2,7 @@ import * as MemoryOnlyKeys from '@userActions/MemoryOnlyKeys/MemoryOnlyKeys'; import * as OnyxUpdates from '@userActions/OnyxUpdates'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import Middleware from './types'; +import type Middleware from './types'; // If we're executing any of these requests, we don't need to trigger our OnyxUpdates flow to update the current data even if our current value is out of // date because all these requests are updating the app to the most current state. diff --git a/src/libs/Middleware/types.ts b/src/libs/Middleware/types.ts index c1d199539b15..4cc0a1cc1026 100644 --- a/src/libs/Middleware/types.ts +++ b/src/libs/Middleware/types.ts @@ -1,5 +1,5 @@ -import Request from '@src/types/onyx/Request'; -import Response from '@src/types/onyx/Response'; +import type Request from '@src/types/onyx/Request'; +import type Response from '@src/types/onyx/Response'; type Middleware = (response: Promise, request: Request, isFromSequentialQueue: boolean) => Promise; diff --git a/src/libs/ModifiedExpenseMessage.ts b/src/libs/ModifiedExpenseMessage.ts index c3d9b0a85339..600cfb48a1c1 100644 --- a/src/libs/ModifiedExpenseMessage.ts +++ b/src/libs/ModifiedExpenseMessage.ts @@ -2,12 +2,12 @@ import {format} from 'date-fns'; import Onyx from 'react-native-onyx'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {PolicyTags, ReportAction} from '@src/types/onyx'; +import type {PolicyTags, ReportAction} from '@src/types/onyx'; import * as CurrencyUtils from './CurrencyUtils'; import * as Localize from './Localize'; import * as PolicyUtils from './PolicyUtils'; import * as ReportUtils from './ReportUtils'; -import {ExpenseOriginalMessage} from './ReportUtils'; +import type {ExpenseOriginalMessage} from './ReportUtils'; let allPolicyTags: Record = {}; Onyx.connect({ diff --git a/src/libs/MoneyRequestUtils.ts b/src/libs/MoneyRequestUtils.ts index 209a82326f43..ff86070395b3 100644 --- a/src/libs/MoneyRequestUtils.ts +++ b/src/libs/MoneyRequestUtils.ts @@ -1,4 +1,4 @@ -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; /** diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index fdef49d71eae..58825ae6f2b1 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -1,6 +1,7 @@ import React, {memo, useEffect, useRef} from 'react'; import {View} from 'react-native'; -import Onyx, {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx, {withOnyx} from 'react-native-onyx'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import KeyboardShortcut from '@libs/KeyboardShortcut'; @@ -29,7 +30,7 @@ import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; -import * as OnyxTypes from '@src/types/onyx'; +import type * as OnyxTypes from '@src/types/onyx'; import type {SelectedTimezone, Timezone} from '@src/types/onyx/PersonalDetails'; import createCustomStackNavigator from './createCustomStackNavigator'; import defaultScreenOptions from './defaultScreenOptions'; diff --git a/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts b/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts index 88ef57807010..e49a94bf4ed7 100644 --- a/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/ModalNavigatorScreenOptions.ts @@ -1,5 +1,6 @@ -import {CardStyleInterpolators, StackNavigationOptions} from '@react-navigation/stack'; -import {ThemeStyles} from '@styles/index'; +import type {StackNavigationOptions} from '@react-navigation/stack'; +import {CardStyleInterpolators} from '@react-navigation/stack'; +import type {ThemeStyles} from '@styles/index'; /** * Modal stack navigator screen options generator function diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx index 151a795a7e36..e177f1c2003d 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx @@ -1,5 +1,6 @@ -import {ParamListBase} from '@react-navigation/routers'; -import {CardStyleInterpolators, createStackNavigator, StackNavigationOptions} from '@react-navigation/stack'; +import type {ParamListBase} from '@react-navigation/routers'; +import type {StackNavigationOptions} from '@react-navigation/stack'; +import {CardStyleInterpolators, createStackNavigator} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import useThemeStyles from '@hooks/useThemeStyles'; import type { diff --git a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx index b7385c930e2c..4e78231b6b6e 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx @@ -1,4 +1,5 @@ -import {createStackNavigator, StackScreenProps} from '@react-navigation/stack'; +import type {StackScreenProps} from '@react-navigation/stack'; +import {createStackNavigator} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; @@ -6,8 +7,8 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import ModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/ModalNavigatorScreenOptions'; import * as ModalStackNavigators from '@libs/Navigation/AppNavigator/ModalStackNavigators'; -import {AuthScreensParamList, LeftModalNavigatorParamList} from '@libs/Navigation/types'; -import NAVIGATORS from '@src/NAVIGATORS'; +import type {AuthScreensParamList, LeftModalNavigatorParamList} from '@libs/Navigation/types'; +import type NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; import Overlay from './Overlay'; diff --git a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx index d7c31bcae7d9..ca33b32113bb 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx @@ -1,4 +1,5 @@ -import {createStackNavigator, StackScreenProps} from '@react-navigation/stack'; +import type {StackScreenProps} from '@react-navigation/stack'; +import {createStackNavigator} from '@react-navigation/stack'; import React, {useMemo} from 'react'; import {View} from 'react-native'; import NoDropZone from '@components/DragAndDrop/NoDropZone'; @@ -7,7 +8,7 @@ import useWindowDimensions from '@hooks/useWindowDimensions'; import ModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/ModalNavigatorScreenOptions'; import * as ModalStackNavigators from '@libs/Navigation/AppNavigator/ModalStackNavigators'; import type {AuthScreensParamList, RightModalNavigatorParamList} from '@navigation/types'; -import NAVIGATORS from '@src/NAVIGATORS'; +import type NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; import Overlay from './Overlay'; diff --git a/src/libs/Navigation/AppNavigator/ReportScreenIDSetter.ts b/src/libs/Navigation/AppNavigator/ReportScreenIDSetter.ts index 7c310435f687..e6e9a7746585 100644 --- a/src/libs/Navigation/AppNavigator/ReportScreenIDSetter.ts +++ b/src/libs/Navigation/AppNavigator/ReportScreenIDSetter.ts @@ -1,5 +1,6 @@ import {useEffect} from 'react'; -import {OnyxCollection, OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import usePermissions from '@hooks/usePermissions'; import * as ReportUtils from '@libs/ReportUtils'; import * as App from '@userActions/App'; diff --git a/src/libs/Navigation/AppNavigator/ReportScreenWrapper.tsx b/src/libs/Navigation/AppNavigator/ReportScreenWrapper.tsx index f3295aadb888..fd764cdb5861 100644 --- a/src/libs/Navigation/AppNavigator/ReportScreenWrapper.tsx +++ b/src/libs/Navigation/AppNavigator/ReportScreenWrapper.tsx @@ -1,8 +1,8 @@ -import {StackScreenProps} from '@react-navigation/stack'; +import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import type {CentralPaneNavigatorParamList} from '@navigation/types'; import ReportScreen from '@pages/home/ReportScreen'; -import SCREENS from '@src/SCREENS'; +import type SCREENS from '@src/SCREENS'; import ReportScreenIDSetter from './ReportScreenIDSetter'; type ReportScreenWrapperProps = StackScreenProps; diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts index 435ebc00362b..10cee2c85952 100644 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts +++ b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts @@ -1,5 +1,6 @@ -import {NavigationState, PartialState, RouterConfigOptions, StackNavigationState, StackRouter} from '@react-navigation/native'; -import {ParamListBase} from '@react-navigation/routers'; +import type {NavigationState, PartialState, RouterConfigOptions, StackNavigationState} from '@react-navigation/native'; +import {StackRouter} from '@react-navigation/native'; +import type {ParamListBase} from '@react-navigation/routers'; import getIsSmallScreenWidth from '@libs/getIsSmallScreenWidth'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.native.tsx b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.native.tsx index a55c74f3a479..151dd0a0f893 100644 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.native.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.native.tsx @@ -1,5 +1,7 @@ -import {createNavigatorFactory, ParamListBase, StackActionHelpers, StackNavigationState, useNavigationBuilder} from '@react-navigation/native'; -import {StackNavigationEventMap, StackNavigationOptions, StackView} from '@react-navigation/stack'; +import type {ParamListBase, StackActionHelpers, StackNavigationState} from '@react-navigation/native'; +import {createNavigatorFactory, useNavigationBuilder} from '@react-navigation/native'; +import type {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; +import {StackView} from '@react-navigation/stack'; import React, {useRef} from 'react'; import useWindowDimensions from '@hooks/useWindowDimensions'; import CustomRouter from './CustomRouter'; diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.tsx b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.tsx index dd2e548064c4..3f6025d5ff0c 100644 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.tsx @@ -1,5 +1,7 @@ -import {createNavigatorFactory, ParamListBase, StackActionHelpers, StackNavigationState, useNavigationBuilder} from '@react-navigation/native'; -import {StackNavigationEventMap, StackNavigationOptions, StackView} from '@react-navigation/stack'; +import type {ParamListBase, StackActionHelpers, StackNavigationState} from '@react-navigation/native'; +import {createNavigatorFactory, useNavigationBuilder} from '@react-navigation/native'; +import type {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; +import {StackView} from '@react-navigation/stack'; import React, {useMemo, useRef} from 'react'; import useWindowDimensions from '@hooks/useWindowDimensions'; import NAVIGATORS from '@src/NAVIGATORS'; diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/types.ts b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/types.ts index 707a0ff4498d..09d35e2a1680 100644 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/types.ts +++ b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/types.ts @@ -1,5 +1,5 @@ -import {DefaultNavigatorOptions, ParamListBase, StackNavigationState, StackRouterOptions} from '@react-navigation/native'; -import {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; +import type {DefaultNavigatorOptions, ParamListBase, StackNavigationState, StackRouterOptions} from '@react-navigation/native'; +import type {StackNavigationEventMap, StackNavigationOptions} from '@react-navigation/stack'; type ResponsiveStackNavigatorConfig = { isSmallScreenWidth: boolean; diff --git a/src/libs/Navigation/AppNavigator/defaultScreenOptions.ts b/src/libs/Navigation/AppNavigator/defaultScreenOptions.ts index 65a6bd052742..4015c43c679e 100644 --- a/src/libs/Navigation/AppNavigator/defaultScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/defaultScreenOptions.ts @@ -1,4 +1,4 @@ -import {StackNavigationOptions} from '@react-navigation/stack'; +import type {StackNavigationOptions} from '@react-navigation/stack'; const defaultScreenOptions: StackNavigationOptions = { cardStyle: { diff --git a/src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts b/src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts index c80ae9914347..1c0f06283226 100644 --- a/src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts +++ b/src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts @@ -1,5 +1,5 @@ -import {StackCardInterpolationProps, StackNavigationOptions} from '@react-navigation/stack'; -import {ThemeStyles} from '@styles/index'; +import type {StackCardInterpolationProps, StackNavigationOptions} from '@react-navigation/stack'; +import type {ThemeStyles} from '@styles/index'; import getNavigationModalCardStyle from '@styles/utils/getNavigationModalCardStyles'; import variables from '@styles/variables'; import CONFIG from '@src/CONFIG'; diff --git a/src/libs/Navigation/FreezeWrapper.tsx b/src/libs/Navigation/FreezeWrapper.tsx index df3f117c9a2e..570553d38017 100644 --- a/src/libs/Navigation/FreezeWrapper.tsx +++ b/src/libs/Navigation/FreezeWrapper.tsx @@ -2,7 +2,7 @@ import {useIsFocused, useNavigation, useRoute} from '@react-navigation/native'; import React, {useEffect, useRef, useState} from 'react'; import {Freeze} from 'react-freeze'; import {InteractionManager} from 'react-native'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type FreezeWrapperProps = ChildrenProps & { /** Prop to disable freeze */ diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 284e5703635a..cc77cd1c4908 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -1,9 +1,11 @@ import {findFocusedRoute} from '@react-navigation/core'; -import {CommonActions, EventArg, getPathFromState, NavigationContainerEventMap, NavigationState, PartialState, StackActions} from '@react-navigation/native'; +import type {EventArg, NavigationContainerEventMap, NavigationState, PartialState} from '@react-navigation/native'; +import {CommonActions, getPathFromState, StackActions} from '@react-navigation/native'; import Log from '@libs/Log'; import CONST from '@src/CONST'; import NAVIGATORS from '@src/NAVIGATORS'; -import ROUTES, {Route} from '@src/ROUTES'; +import type {Route} from '@src/ROUTES'; +import ROUTES from '@src/ROUTES'; import {PROTECTED_SCREENS} from '@src/SCREENS'; import originalDismissModal from './dismissModal'; import originalGetTopmostReportActionId from './getTopmostReportActionID'; @@ -11,7 +13,7 @@ import originalGetTopmostReportId from './getTopmostReportId'; import linkingConfig from './linkingConfig'; import linkTo from './linkTo'; import navigationRef from './navigationRef'; -import {StateOrRoute} from './types'; +import type {StateOrRoute} from './types'; let resolveNavigationIsReadyPromise: () => void; const navigationIsReadyPromise = new Promise((resolve) => { diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 48523162ba2e..79ec18d28d4f 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -1,4 +1,5 @@ -import {DefaultTheme, getPathFromState, NavigationContainer, NavigationState} from '@react-navigation/native'; +import type {NavigationState} from '@react-navigation/native'; +import {DefaultTheme, getPathFromState, NavigationContainer} from '@react-navigation/native'; import React, {useEffect, useMemo, useRef} from 'react'; import useCurrentReportID from '@hooks/useCurrentReportID'; import useFlipper from '@hooks/useFlipper'; diff --git a/src/libs/Navigation/OnyxTabNavigator.tsx b/src/libs/Navigation/OnyxTabNavigator.tsx index ef41269045c6..624aaec72bda 100644 --- a/src/libs/Navigation/OnyxTabNavigator.tsx +++ b/src/libs/Navigation/OnyxTabNavigator.tsx @@ -1,11 +1,12 @@ -import {createMaterialTopTabNavigator, MaterialTopTabNavigationEventMap} from '@react-navigation/material-top-tabs'; -import {EventMapCore, NavigationState, ScreenListeners} from '@react-navigation/native'; +import type {MaterialTopTabNavigationEventMap} from '@react-navigation/material-top-tabs'; +import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs'; +import type {EventMapCore, NavigationState, ScreenListeners} from '@react-navigation/native'; import React from 'react'; import {withOnyx} from 'react-native-onyx'; -import {OnyxEntry} from 'react-native-onyx/lib/types'; +import type {OnyxEntry} from 'react-native-onyx/lib/types'; import Tab from '@userActions/Tab'; import ONYXKEYS from '@src/ONYXKEYS'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type OnyxTabNavigatorOnyxProps = { selectedTab: OnyxEntry; diff --git a/src/libs/Navigation/currentUrl/index.native.ts b/src/libs/Navigation/currentUrl/index.native.ts index 0c12ab8b4883..3f63391ab425 100644 --- a/src/libs/Navigation/currentUrl/index.native.ts +++ b/src/libs/Navigation/currentUrl/index.native.ts @@ -1,4 +1,4 @@ -import GetCurrentUrl from './types'; +import type GetCurrentUrl from './types'; const getCurrentUrl: GetCurrentUrl = () => ''; diff --git a/src/libs/Navigation/currentUrl/index.ts b/src/libs/Navigation/currentUrl/index.ts index f9afc6e15775..ecf3f6f17a9b 100644 --- a/src/libs/Navigation/currentUrl/index.ts +++ b/src/libs/Navigation/currentUrl/index.ts @@ -1,4 +1,4 @@ -import GetCurrentUrl from './types'; +import type GetCurrentUrl from './types'; const getCurrentUrl: GetCurrentUrl = () => window.location.href; diff --git a/src/libs/Navigation/dismissModal.ts b/src/libs/Navigation/dismissModal.ts index 37b4c6d9b9e6..917f1c86c90c 100644 --- a/src/libs/Navigation/dismissModal.ts +++ b/src/libs/Navigation/dismissModal.ts @@ -1,5 +1,6 @@ import {getActionFromState} from '@react-navigation/core'; -import {NavigationContainerRef, StackActions} from '@react-navigation/native'; +import type {NavigationContainerRef} from '@react-navigation/native'; +import {StackActions} from '@react-navigation/native'; import {findLastIndex} from 'lodash'; import Log from '@libs/Log'; import NAVIGATORS from '@src/NAVIGATORS'; @@ -8,7 +9,7 @@ import SCREENS from '@src/SCREENS'; import getStateFromPath from './getStateFromPath'; import getTopmostReportId from './getTopmostReportId'; import linkingConfig from './linkingConfig'; -import {RootStackParamList, StackNavigationAction} from './types'; +import type {RootStackParamList, StackNavigationAction} from './types'; // This function is in a separate file than Navigation.js to avoid cyclic dependency. diff --git a/src/libs/Navigation/getStateFromPath.ts b/src/libs/Navigation/getStateFromPath.ts index 3a53b02fc3c7..0476ffac1494 100644 --- a/src/libs/Navigation/getStateFromPath.ts +++ b/src/libs/Navigation/getStateFromPath.ts @@ -1,5 +1,6 @@ -import {NavigationState, PartialState, getStateFromPath as RNGetStateFromPath} from '@react-navigation/native'; -import {Route} from '@src/ROUTES'; +import type {NavigationState, PartialState} from '@react-navigation/native'; +import {getStateFromPath as RNGetStateFromPath} from '@react-navigation/native'; +import type {Route} from '@src/ROUTES'; import linkingConfig from './linkingConfig'; /** diff --git a/src/libs/Navigation/getTopmostReportActionID.ts b/src/libs/Navigation/getTopmostReportActionID.ts index 15ab1efef704..f9931343b2eb 100644 --- a/src/libs/Navigation/getTopmostReportActionID.ts +++ b/src/libs/Navigation/getTopmostReportActionID.ts @@ -1,7 +1,7 @@ -import {NavigationState, PartialState} from '@react-navigation/native'; +import type {NavigationState, PartialState} from '@react-navigation/native'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; -import {RootStackParamList} from './types'; +import type {RootStackParamList} from './types'; // This function is in a separate file than Navigation.js to avoid cyclic dependency. diff --git a/src/libs/Navigation/getTopmostReportId.ts b/src/libs/Navigation/getTopmostReportId.ts index 3342761e7ccf..2c3b74e9f52f 100644 --- a/src/libs/Navigation/getTopmostReportId.ts +++ b/src/libs/Navigation/getTopmostReportId.ts @@ -1,7 +1,7 @@ -import {NavigationState, PartialState} from '@react-navigation/native'; +import type {NavigationState, PartialState} from '@react-navigation/native'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; -import {RootStackParamList} from './types'; +import type {RootStackParamList} from './types'; // This function is in a separate file than Navigation.js to avoid cyclic dependency. diff --git a/src/libs/Navigation/linkTo.ts b/src/libs/Navigation/linkTo.ts index 86558765a6e6..b7746108ac93 100644 --- a/src/libs/Navigation/linkTo.ts +++ b/src/libs/Navigation/linkTo.ts @@ -1,14 +1,14 @@ import {getActionFromState} from '@react-navigation/core'; -import {NavigationAction, NavigationContainerRef, NavigationState, PartialState} from '@react-navigation/native'; -import {Writable} from 'type-fest'; +import type {NavigationAction, NavigationContainerRef, NavigationState, PartialState} from '@react-navigation/native'; +import type {Writable} from 'type-fest'; import CONST from '@src/CONST'; import NAVIGATORS from '@src/NAVIGATORS'; -import {Route} from '@src/ROUTES'; +import type {Route} from '@src/ROUTES'; import dismissModal from './dismissModal'; import getStateFromPath from './getStateFromPath'; import getTopmostReportId from './getTopmostReportId'; import linkingConfig from './linkingConfig'; -import {NavigationRoot, RootStackParamList, StackNavigationAction} from './types'; +import type {NavigationRoot, RootStackParamList, StackNavigationAction} from './types'; type ActionPayloadParams = { screen?: string; diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index 5f7ecd10cc8c..3b2350afcc43 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -1,10 +1,10 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import {LinkingOptions} from '@react-navigation/native'; +import type {LinkingOptions} from '@react-navigation/native'; import CONST from '@src/CONST'; import NAVIGATORS from '@src/NAVIGATORS'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; -import {RootStackParamList} from './types'; +import type {RootStackParamList} from './types'; const linkingConfig: LinkingOptions = { prefixes: [ diff --git a/src/libs/Navigation/navigationRef.ts b/src/libs/Navigation/navigationRef.ts index 032d9f9f3d9a..17742e5d0937 100644 --- a/src/libs/Navigation/navigationRef.ts +++ b/src/libs/Navigation/navigationRef.ts @@ -1,5 +1,5 @@ import {createNavigationContainerRef} from '@react-navigation/native'; -import {NavigationRef} from './types'; +import type {NavigationRef} from './types'; const navigationRef: NavigationRef = createNavigationContainerRef(); diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 4823b44b89cb..505bc82180f4 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import {CommonActions, NavigationContainerRefWithCurrent, NavigationHelpers, NavigationState, NavigatorScreenParams, PartialRoute, Route} from '@react-navigation/native'; -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import NAVIGATORS from '@src/NAVIGATORS'; -import SCREENS from '@src/SCREENS'; +import type {CommonActions, NavigationContainerRefWithCurrent, NavigationHelpers, NavigationState, NavigatorScreenParams, PartialRoute, Route} from '@react-navigation/native'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type NAVIGATORS from '@src/NAVIGATORS'; +import type SCREENS from '@src/SCREENS'; type NavigationRef = NavigationContainerRefWithCurrent; diff --git a/src/libs/Network/MainQueue.ts b/src/libs/Network/MainQueue.ts index 3ae0d44680a4..b3d6fbea94ab 100644 --- a/src/libs/Network/MainQueue.ts +++ b/src/libs/Network/MainQueue.ts @@ -1,5 +1,5 @@ import * as Request from '@libs/Request'; -import OnyxRequest from '@src/types/onyx/Request'; +import type OnyxRequest from '@src/types/onyx/Request'; import * as NetworkStore from './NetworkStore'; import * as SequentialQueue from './SequentialQueue'; diff --git a/src/libs/Network/NetworkStore.ts b/src/libs/Network/NetworkStore.ts index 52e4147f1b3c..59a52dfd01c4 100644 --- a/src/libs/Network/NetworkStore.ts +++ b/src/libs/Network/NetworkStore.ts @@ -1,6 +1,6 @@ import Onyx from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; -import Credentials from '@src/types/onyx/Credentials'; +import type Credentials from '@src/types/onyx/Credentials'; let credentials: Credentials | null = null; let authToken: string | null = null; diff --git a/src/libs/Network/SequentialQueue.ts b/src/libs/Network/SequentialQueue.ts index 5da032baaf45..f9a7cd0a996b 100644 --- a/src/libs/Network/SequentialQueue.ts +++ b/src/libs/Network/SequentialQueue.ts @@ -6,7 +6,7 @@ import * as PersistedRequests from '@userActions/PersistedRequests'; import * as QueuedOnyxUpdates from '@userActions/QueuedOnyxUpdates'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import OnyxRequest from '@src/types/onyx/Request'; +import type OnyxRequest from '@src/types/onyx/Request'; import * as NetworkStore from './NetworkStore'; let resolveIsReadyPromise: ((args?: unknown[]) => void) | undefined; diff --git a/src/libs/Network/index.ts b/src/libs/Network/index.ts index 4ccb8df01163..2adb4a2da4c2 100644 --- a/src/libs/Network/index.ts +++ b/src/libs/Network/index.ts @@ -1,7 +1,7 @@ import * as ActiveClientManager from '@libs/ActiveClientManager'; import CONST from '@src/CONST'; -import {Request} from '@src/types/onyx'; -import Response from '@src/types/onyx/Response'; +import type {Request} from '@src/types/onyx'; +import type Response from '@src/types/onyx/Response'; import pkg from '../../../package.json'; import * as MainQueue from './MainQueue'; import * as SequentialQueue from './SequentialQueue'; diff --git a/src/libs/Notification/LocalNotification/BrowserNotifications.ts b/src/libs/Notification/LocalNotification/BrowserNotifications.ts index 6bd6c73982eb..e65bd3d0021f 100644 --- a/src/libs/Notification/LocalNotification/BrowserNotifications.ts +++ b/src/libs/Notification/LocalNotification/BrowserNotifications.ts @@ -1,13 +1,13 @@ // Web and desktop implementation only. Do not import for direct use. Use LocalNotification. import Str from 'expensify-common/lib/str'; -import {ImageSourcePropType} from 'react-native'; +import type {ImageSourcePropType} from 'react-native'; import EXPENSIFY_ICON_URL from '@assets/images/expensify-logo-round-clearspace.png'; import ModifiedExpenseMessage from '@libs/ModifiedExpenseMessage'; import * as ReportUtils from '@libs/ReportUtils'; import * as AppUpdate from '@userActions/AppUpdate'; -import {Report, ReportAction} from '@src/types/onyx'; +import type {Report, ReportAction} from '@src/types/onyx'; import focusApp from './focusApp'; -import {LocalNotificationClickHandler, LocalNotificationData} from './types'; +import type {LocalNotificationClickHandler, LocalNotificationData} from './types'; const notificationCache: Record = {}; diff --git a/src/libs/Notification/LocalNotification/focusApp/index.desktop.ts b/src/libs/Notification/LocalNotification/focusApp/index.desktop.ts index 2b6f01457f44..595bd273c098 100644 --- a/src/libs/Notification/LocalNotification/focusApp/index.desktop.ts +++ b/src/libs/Notification/LocalNotification/focusApp/index.desktop.ts @@ -1,5 +1,5 @@ import ELECTRON_EVENTS from '../../../../../desktop/ELECTRON_EVENTS'; -import FocusApp from './types'; +import type FocusApp from './types'; const focusApp: FocusApp = () => { window.electron.send(ELECTRON_EVENTS.REQUEST_FOCUS_APP); diff --git a/src/libs/Notification/LocalNotification/focusApp/index.ts b/src/libs/Notification/LocalNotification/focusApp/index.ts index 8504fde1bcb2..c5c069f9ddf6 100644 --- a/src/libs/Notification/LocalNotification/focusApp/index.ts +++ b/src/libs/Notification/LocalNotification/focusApp/index.ts @@ -1,4 +1,4 @@ -import FocusApp from './types'; +import type FocusApp from './types'; // On web this is up to the browser that shows the notifications const focusApp: FocusApp = () => {}; diff --git a/src/libs/Notification/LocalNotification/index.desktop.ts b/src/libs/Notification/LocalNotification/index.desktop.ts index e2aa5fcf2830..4baf1abee139 100644 --- a/src/libs/Notification/LocalNotification/index.desktop.ts +++ b/src/libs/Notification/LocalNotification/index.desktop.ts @@ -1,6 +1,6 @@ -import {Report, ReportAction} from '@src/types/onyx'; +import type {Report, ReportAction} from '@src/types/onyx'; import BrowserNotifications from './BrowserNotifications'; -import {LocalNotificationClickHandler, LocalNotificationModule} from './types'; +import type {LocalNotificationClickHandler, LocalNotificationModule} from './types'; function showCommentNotification(report: Report, reportAction: ReportAction, onClick: LocalNotificationClickHandler) { BrowserNotifications.pushReportCommentNotification(report, reportAction, onClick); diff --git a/src/libs/Notification/LocalNotification/index.native.ts b/src/libs/Notification/LocalNotification/index.native.ts index 2b4e54286c06..49868d8515c9 100644 --- a/src/libs/Notification/LocalNotification/index.native.ts +++ b/src/libs/Notification/LocalNotification/index.native.ts @@ -1,4 +1,4 @@ -import {LocalNotificationModule} from './types'; +import type {LocalNotificationModule} from './types'; // Local Notifications are not currently supported on mobile so we'll just no-op here. const LocalNotification: LocalNotificationModule = { diff --git a/src/libs/Notification/LocalNotification/index.ts b/src/libs/Notification/LocalNotification/index.ts index 469e5f9bc08b..2141000d807d 100644 --- a/src/libs/Notification/LocalNotification/index.ts +++ b/src/libs/Notification/LocalNotification/index.ts @@ -1,6 +1,6 @@ -import {Report, ReportAction} from '@src/types/onyx'; +import type {Report, ReportAction} from '@src/types/onyx'; import BrowserNotifications from './BrowserNotifications'; -import {LocalNotificationClickHandler, LocalNotificationModule} from './types'; +import type {LocalNotificationClickHandler, LocalNotificationModule} from './types'; function showCommentNotification(report: Report, reportAction: ReportAction, onClick: LocalNotificationClickHandler) { BrowserNotifications.pushReportCommentNotification(report, reportAction, onClick, true); diff --git a/src/libs/Notification/LocalNotification/types.ts b/src/libs/Notification/LocalNotification/types.ts index d8441fb1f4bb..dc9607743dfb 100644 --- a/src/libs/Notification/LocalNotification/types.ts +++ b/src/libs/Notification/LocalNotification/types.ts @@ -1,5 +1,5 @@ -import ClearReportNotifications from '@libs/Notification/clearReportNotifications/types'; -import {Report, ReportAction} from '@src/types/onyx'; +import type ClearReportNotifications from '@libs/Notification/clearReportNotifications/types'; +import type {Report, ReportAction} from '@src/types/onyx'; type LocalNotificationClickHandler = () => void; diff --git a/src/libs/Notification/PushNotification/ForegroundNotifications/index.android.ts b/src/libs/Notification/PushNotification/ForegroundNotifications/index.android.ts index 5eef0b44a7d1..d7099c4c3d6b 100644 --- a/src/libs/Notification/PushNotification/ForegroundNotifications/index.android.ts +++ b/src/libs/Notification/PushNotification/ForegroundNotifications/index.android.ts @@ -1,6 +1,6 @@ import Airship from '@ua/react-native-airship'; import shouldShowPushNotification from '@libs/Notification/PushNotification/shouldShowPushNotification'; -import ForegroundNotificationsModule from './types'; +import type ForegroundNotificationsModule from './types'; function configureForegroundNotifications() { Airship.push.android.setForegroundDisplayPredicate((pushPayload) => Promise.resolve(shouldShowPushNotification(pushPayload))); diff --git a/src/libs/Notification/PushNotification/ForegroundNotifications/index.ios.ts b/src/libs/Notification/PushNotification/ForegroundNotifications/index.ios.ts index e5e5665d1ea2..e5004ae2bf0b 100644 --- a/src/libs/Notification/PushNotification/ForegroundNotifications/index.ios.ts +++ b/src/libs/Notification/PushNotification/ForegroundNotifications/index.ios.ts @@ -1,6 +1,6 @@ import Airship, {iOS} from '@ua/react-native-airship'; import shouldShowPushNotification from '@libs/Notification/PushNotification/shouldShowPushNotification'; -import ForegroundNotificationsModule from './types'; +import type ForegroundNotificationsModule from './types'; function configureForegroundNotifications() { // Set our default iOS foreground presentation to be loud with a banner diff --git a/src/libs/Notification/PushNotification/ForegroundNotifications/index.ts b/src/libs/Notification/PushNotification/ForegroundNotifications/index.ts index 25baa34099b6..e397c2a570ee 100644 --- a/src/libs/Notification/PushNotification/ForegroundNotifications/index.ts +++ b/src/libs/Notification/PushNotification/ForegroundNotifications/index.ts @@ -1,4 +1,4 @@ -import ForegroundNotificationsModule from './types'; +import type ForegroundNotificationsModule from './types'; /** * Configures notification handling while in the foreground on iOS and Android. This is a no-op on other platforms. diff --git a/src/libs/Notification/PushNotification/NotificationType.ts b/src/libs/Notification/PushNotification/NotificationType.ts index 91eec6895394..d6ec246eddf7 100644 --- a/src/libs/Notification/PushNotification/NotificationType.ts +++ b/src/libs/Notification/PushNotification/NotificationType.ts @@ -1,4 +1,4 @@ -import {OnyxServerUpdate} from '@src/types/onyx/OnyxUpdatesFromServer'; +import type {OnyxServerUpdate} from '@src/types/onyx/OnyxUpdatesFromServer'; const NotificationType = { REPORT_COMMENT: 'reportComment', diff --git a/src/libs/Notification/PushNotification/backgroundRefresh/index.android.ts b/src/libs/Notification/PushNotification/backgroundRefresh/index.android.ts index 2b3c6ebf21b4..ff63f5aefa2b 100644 --- a/src/libs/Notification/PushNotification/backgroundRefresh/index.android.ts +++ b/src/libs/Notification/PushNotification/backgroundRefresh/index.android.ts @@ -4,7 +4,7 @@ import Visibility from '@libs/Visibility'; import * as App from '@userActions/App'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import BackgroundRefresh from './types'; +import type BackgroundRefresh from './types'; function getLastOnyxUpdateID(): Promise { return new Promise((resolve) => { diff --git a/src/libs/Notification/PushNotification/backgroundRefresh/index.ts b/src/libs/Notification/PushNotification/backgroundRefresh/index.ts index c7f47a532d89..54fd14e219a9 100644 --- a/src/libs/Notification/PushNotification/backgroundRefresh/index.ts +++ b/src/libs/Notification/PushNotification/backgroundRefresh/index.ts @@ -1,4 +1,4 @@ -import BackgroundRefresh from './types'; +import type BackgroundRefresh from './types'; /** * Runs our reconnectApp action if the app is in the background. diff --git a/src/libs/Notification/PushNotification/index.native.ts b/src/libs/Notification/PushNotification/index.native.ts index 7b2571eea368..382591e5b698 100644 --- a/src/libs/Notification/PushNotification/index.native.ts +++ b/src/libs/Notification/PushNotification/index.native.ts @@ -1,11 +1,14 @@ -import Airship, {EventType, PushPayload} from '@ua/react-native-airship'; +import type {PushPayload} from '@ua/react-native-airship'; +import Airship, {EventType} from '@ua/react-native-airship'; import Onyx from 'react-native-onyx'; import Log from '@libs/Log'; import * as PushNotificationActions from '@userActions/PushNotification'; import ONYXKEYS from '@src/ONYXKEYS'; import ForegroundNotifications from './ForegroundNotifications'; -import NotificationType, {NotificationData} from './NotificationType'; -import PushNotificationType, {ClearNotifications, Deregister, Init, OnReceived, OnSelected, Register} from './types'; +import type {NotificationData} from './NotificationType'; +import NotificationType from './NotificationType'; +import type {ClearNotifications, Deregister, Init, OnReceived, OnSelected, Register} from './types'; +import type PushNotificationType from './types'; type NotificationEventActionCallback = (data: NotificationData) => void; diff --git a/src/libs/Notification/PushNotification/index.ts b/src/libs/Notification/PushNotification/index.ts index 1e5499d1fe7d..66f3d91af7c6 100644 --- a/src/libs/Notification/PushNotification/index.ts +++ b/src/libs/Notification/PushNotification/index.ts @@ -1,5 +1,5 @@ import NotificationType from './NotificationType'; -import PushNotificationType from './types'; +import type PushNotificationType from './types'; // Push notifications are only supported on mobile, so we'll just noop here const PushNotification: PushNotificationType = { diff --git a/src/libs/Notification/PushNotification/shouldShowPushNotification.ts b/src/libs/Notification/PushNotification/shouldShowPushNotification.ts index 46f99fcc9271..89aa53b5634a 100644 --- a/src/libs/Notification/PushNotification/shouldShowPushNotification.ts +++ b/src/libs/Notification/PushNotification/shouldShowPushNotification.ts @@ -1,8 +1,8 @@ -import {PushPayload} from '@ua/react-native-airship'; +import type {PushPayload} from '@ua/react-native-airship'; import Log from '@libs/Log'; import * as ReportActionUtils from '@libs/ReportActionsUtils'; import * as Report from '@userActions/Report'; -import {NotificationData} from './NotificationType'; +import type {NotificationData} from './NotificationType'; /** * Returns whether the given Airship notification should be shown depending on the current state of the app diff --git a/src/libs/Notification/PushNotification/types.ts b/src/libs/Notification/PushNotification/types.ts index f72ee1af887a..4399c10b4a95 100644 --- a/src/libs/Notification/PushNotification/types.ts +++ b/src/libs/Notification/PushNotification/types.ts @@ -1,5 +1,6 @@ -import {ValueOf} from 'type-fest'; -import NotificationType, {NotificationDataMap} from './NotificationType'; +import type {ValueOf} from 'type-fest'; +import type {NotificationDataMap} from './NotificationType'; +import type NotificationType from './NotificationType'; type Init = () => void; type Register = (notificationID: string | number) => void; diff --git a/src/libs/Notification/clearReportNotifications/index.android.ts b/src/libs/Notification/clearReportNotifications/index.android.ts index 8f0e8cc2ea69..8c2a44ba29d3 100644 --- a/src/libs/Notification/clearReportNotifications/index.android.ts +++ b/src/libs/Notification/clearReportNotifications/index.android.ts @@ -1,4 +1,4 @@ -import ClearReportNotifications from './types'; +import type ClearReportNotifications from './types'; /** * This is a temporary fix for issues with our Notification Cache not being cleared in Android. diff --git a/src/libs/Notification/clearReportNotifications/index.ios.ts b/src/libs/Notification/clearReportNotifications/index.ios.ts index 74b2c7faa50f..d9a30320a02e 100644 --- a/src/libs/Notification/clearReportNotifications/index.ios.ts +++ b/src/libs/Notification/clearReportNotifications/index.ios.ts @@ -1,8 +1,9 @@ -import Airship, {PushPayload} from '@ua/react-native-airship'; +import type {PushPayload} from '@ua/react-native-airship'; +import Airship from '@ua/react-native-airship'; import Log from '@libs/Log'; -import {NotificationData} from '@libs/Notification/PushNotification/NotificationType'; +import type {NotificationData} from '@libs/Notification/PushNotification/NotificationType'; import CONST from '@src/CONST'; -import ClearReportNotifications from './types'; +import type ClearReportNotifications from './types'; const parseNotificationAndReportIDs = (pushPayload: PushPayload) => { let payload = pushPayload.extras.payload; diff --git a/src/libs/Notification/clearReportNotifications/index.ts b/src/libs/Notification/clearReportNotifications/index.ts index fa8ceac6b05d..a154bf89d764 100644 --- a/src/libs/Notification/clearReportNotifications/index.ts +++ b/src/libs/Notification/clearReportNotifications/index.ts @@ -1,5 +1,5 @@ import LocalNotification from '@libs/Notification/LocalNotification'; -import ClearReportNotifications from './types'; +import type ClearReportNotifications from './types'; const clearReportNotifications: ClearReportNotifications = LocalNotification.clearReportNotifications; export default clearReportNotifications; diff --git a/src/libs/NumberFormatUtils.ts b/src/libs/NumberFormatUtils.ts index b077f0ce0862..bf42e25cbb48 100644 --- a/src/libs/NumberFormatUtils.ts +++ b/src/libs/NumberFormatUtils.ts @@ -1,5 +1,5 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; function format(locale: ValueOf, number: number, options?: Intl.NumberFormatOptions): string { return new Intl.NumberFormat(locale, options).format(number); diff --git a/src/libs/OnyxSelectors/reportWithoutHasDraftSelector.ts b/src/libs/OnyxSelectors/reportWithoutHasDraftSelector.ts index 9fd89cfdf146..1062aa4b45c6 100644 --- a/src/libs/OnyxSelectors/reportWithoutHasDraftSelector.ts +++ b/src/libs/OnyxSelectors/reportWithoutHasDraftSelector.ts @@ -1,4 +1,4 @@ -import {OnyxKeyValue} from '@src/ONYXKEYS'; +import type {OnyxKeyValue} from '@src/ONYXKEYS'; export default function reportWithoutHasDraftSelector(report: OnyxKeyValue<'report_'>) { if (!report) { diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index fa3538b58ca6..9efff6f2fdb7 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -854,31 +854,34 @@ function getCategoryListSections(categories, recentlyUsedCategories, selectedOpt return categorySections; } - if (numberOfCategories < CONST.CATEGORY_LIST_THRESHOLD) { + if (!_.isEmpty(selectedOptions)) { categorySections.push({ - // "All" section when items amount less than the threshold + // "Selected" section title: '', shouldShow: false, indexOffset, - data: getCategoryOptionTree(enabledCategories), + data: getCategoryOptionTree(selectedOptions, true), }); - return categorySections; + indexOffset += selectedOptions.length; } - if (!_.isEmpty(selectedOptions)) { + const selectedOptionNames = _.map(selectedOptions, (selectedOption) => selectedOption.name); + const filteredCategories = _.filter(enabledCategories, (category) => !_.includes(selectedOptionNames, category.name)); + const numberOfVisibleCategories = selectedOptions.length + filteredCategories.length; + + if (numberOfVisibleCategories < CONST.CATEGORY_LIST_THRESHOLD) { categorySections.push({ - // "Selected" section + // "All" section when items amount less than the threshold title: '', - shouldShow: true, + shouldShow: false, indexOffset, - data: getCategoryOptionTree(selectedOptions, true), + data: getCategoryOptionTree(filteredCategories), }); - indexOffset += selectedOptions.length; + return categorySections; } - const selectedOptionNames = _.map(selectedOptions, (selectedOption) => selectedOption.name); const filteredRecentlyUsedCategories = _.chain(recentlyUsedCategories) .filter((categoryName) => !_.includes(selectedOptionNames, categoryName) && lodashGet(categories, [categoryName, 'enabled'], false)) .map((categoryName) => ({ @@ -901,8 +904,6 @@ function getCategoryListSections(categories, recentlyUsedCategories, selectedOpt indexOffset += filteredRecentlyUsedCategories.length; } - const filteredCategories = _.filter(enabledCategories, (category) => !_.includes(selectedOptionNames, category.name)); - categorySections.push({ // "All" section when items amount more than the threshold title: Localize.translateLocal('common.all'), diff --git a/src/libs/PaymentUtils.ts b/src/libs/PaymentUtils.ts index e41b3295a2c5..dd35d0df5cfb 100644 --- a/src/libs/PaymentUtils.ts +++ b/src/libs/PaymentUtils.ts @@ -1,9 +1,9 @@ import getBankIcon from '@components/Icon/BankIcons'; -import {type ThemeStyles} from '@styles/index'; +import type {ThemeStyles} from '@styles/index'; import CONST from '@src/CONST'; -import BankAccount from '@src/types/onyx/BankAccount'; -import Fund from '@src/types/onyx/Fund'; -import PaymentMethod from '@src/types/onyx/PaymentMethod'; +import type BankAccount from '@src/types/onyx/BankAccount'; +import type Fund from '@src/types/onyx/Fund'; +import type PaymentMethod from '@src/types/onyx/PaymentMethod'; import * as Localize from './Localize'; import BankAccountModel from './models/BankAccount'; diff --git a/src/libs/Performance.tsx b/src/libs/Performance.tsx index 03d701e50075..a2667955326d 100644 --- a/src/libs/Performance.tsx +++ b/src/libs/Performance.tsx @@ -3,8 +3,8 @@ import isObject from 'lodash/isObject'; import lodashTransform from 'lodash/transform'; import React, {forwardRef, Profiler} from 'react'; import {Alert, InteractionManager} from 'react-native'; -import {PerformanceEntry, PerformanceMark, PerformanceMeasure, Performance as RNPerformance} from 'react-native-performance'; -import {PerformanceObserverEntryList} from 'react-native-performance/lib/typescript/performance-observer'; +import type {PerformanceEntry, PerformanceMark, PerformanceMeasure, Performance as RNPerformance} from 'react-native-performance'; +import type {PerformanceObserverEntryList} from 'react-native-performance/lib/typescript/performance-observer'; import CONST from '@src/CONST'; import isE2ETestSession from './E2E/isE2ETestSession'; import getComponentDisplayName from './getComponentDisplayName'; diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 9cde613ebb5a..85e64651980e 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -1,6 +1,6 @@ -import {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; import CONST from '@src/CONST'; -import Beta from '@src/types/onyx/Beta'; +import type Beta from '@src/types/onyx/Beta'; function canUseAllBetas(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.ALL); diff --git a/src/libs/PersonalDetailsUtils.ts b/src/libs/PersonalDetailsUtils.ts index 3eb752bac983..3346094adeec 100644 --- a/src/libs/PersonalDetailsUtils.ts +++ b/src/libs/PersonalDetailsUtils.ts @@ -1,13 +1,13 @@ -import Onyx, {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import * as OnyxTypes from '@src/types/onyx'; -import {PersonalDetails, PersonalDetailsList} from '@src/types/onyx'; +import type {PersonalDetails, PersonalDetailsList, PrivatePersonalDetails} from '@src/types/onyx'; import * as LocalePhoneNumber from './LocalePhoneNumber'; import * as Localize from './Localize'; import * as UserUtils from './UserUtils'; -let personalDetails: Array = []; +let personalDetails: Array = []; let allPersonalDetails: OnyxEntry = {}; Onyx.connect({ key: ONYXKEYS.PERSONAL_DETAILS_LIST, @@ -30,11 +30,11 @@ function getDisplayNameOrDefault(passedPersonalDetails?: Partial !!allPersonalDetails?.[accountID]) .map((accountID) => { - const detail = (allPersonalDetails?.[accountID] ?? {}) as OnyxTypes.PersonalDetails; + const detail = (allPersonalDetails?.[accountID] ?? {}) as PersonalDetails; if (shouldChangeUserDisplayName && currentUserAccountID === detail.accountID) { return { @@ -76,7 +76,7 @@ function getAccountIDsByLogins(logins: string[]): number[] { */ function getLoginsByAccountIDs(accountIDs: number[]): string[] { return accountIDs.reduce((foundLogins: string[], accountID) => { - const currentDetail: Partial = personalDetails.find((detail) => Number(detail?.accountID) === Number(accountID)) ?? {}; + const currentDetail: Partial = personalDetails.find((detail) => Number(detail?.accountID) === Number(accountID)) ?? {}; if (currentDetail.login) { foundLogins.push(currentDetail.login); } @@ -176,7 +176,7 @@ function getStreetLines(street = '') { * @param privatePersonalDetails - details object * @returns - formatted address */ -function getFormattedAddress(privatePersonalDetails: OnyxTypes.PrivatePersonalDetails): string { +function getFormattedAddress(privatePersonalDetails: PrivatePersonalDetails): string { const {address} = privatePersonalDetails; const [street1, street2] = getStreetLines(address?.street); const formattedAddress = diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index bc7ddb14b53e..0cab97299324 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -1,9 +1,10 @@ import Str from 'expensify-common/lib/str'; -import {OnyxCollection, OnyxEntry} from 'react-native-onyx'; +import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {PersonalDetailsList, Policy, PolicyMembers, PolicyTag, PolicyTags} from '@src/types/onyx'; -import {EmptyObject, isEmptyObject} from '@src/types/utils/EmptyObject'; +import type {PersonalDetailsList, Policy, PolicyMembers, PolicyTag, PolicyTags} from '@src/types/onyx'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; type MemberEmailsToAccountIDs = Record; type UnitRate = {rate: number}; diff --git a/src/libs/Pusher/library/index.native.ts b/src/libs/Pusher/library/index.native.ts index f50834366515..4f11506f10fa 100644 --- a/src/libs/Pusher/library/index.native.ts +++ b/src/libs/Pusher/library/index.native.ts @@ -3,7 +3,7 @@ * @see: https://github.com/pusher/pusher-js */ import PusherImplementation from 'pusher-js/react-native'; -import Pusher from './types'; +import type Pusher from './types'; const PusherNative: Pusher = PusherImplementation; diff --git a/src/libs/Pusher/library/types.ts b/src/libs/Pusher/library/types.ts index cc8c70fccdbb..566fd8a72774 100644 --- a/src/libs/Pusher/library/types.ts +++ b/src/libs/Pusher/library/types.ts @@ -1,5 +1,5 @@ -import PusherClass from 'pusher-js/with-encryption'; -import {LiteralUnion} from 'type-fest'; +import type PusherClass from 'pusher-js/with-encryption'; +import type {LiteralUnion} from 'type-fest'; type Pusher = typeof PusherClass; diff --git a/src/libs/Pusher/pusher.ts b/src/libs/Pusher/pusher.ts index 33219b1dfe73..b6a5390bd501 100644 --- a/src/libs/Pusher/pusher.ts +++ b/src/libs/Pusher/pusher.ts @@ -1,15 +1,15 @@ import isObject from 'lodash/isObject'; -import {Channel, ChannelAuthorizerGenerator, Options} from 'pusher-js/with-encryption'; +import type {Channel, ChannelAuthorizerGenerator, Options} from 'pusher-js/with-encryption'; import Onyx from 'react-native-onyx'; -import {LiteralUnion, ValueOf} from 'type-fest'; +import type {LiteralUnion, ValueOf} from 'type-fest'; import Log from '@libs/Log'; -import CONST from '@src/CONST'; +import type CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {OnyxUpdateEvent, OnyxUpdatesFromServer, ReportUserIsTyping} from '@src/types/onyx'; -import DeepValueOf from '@src/types/utils/DeepValueOf'; +import type {OnyxUpdateEvent, OnyxUpdatesFromServer, ReportUserIsTyping} from '@src/types/onyx'; +import type DeepValueOf from '@src/types/utils/DeepValueOf'; import TYPE from './EventType'; import Pusher from './library'; -import {SocketEventName} from './library/types'; +import type {SocketEventName} from './library/types'; type States = { previous: string; diff --git a/src/libs/PusherConnectionManager.ts b/src/libs/PusherConnectionManager.ts index a0c5673af729..597670d3f5ad 100644 --- a/src/libs/PusherConnectionManager.ts +++ b/src/libs/PusherConnectionManager.ts @@ -1,10 +1,10 @@ -import {ChannelAuthorizationCallback} from 'pusher-js/with-encryption'; +import type {ChannelAuthorizationCallback} from 'pusher-js/with-encryption'; import CONST from '@src/CONST'; import * as Session from './actions/Session'; import Log from './Log'; -import {SocketEventName} from './Pusher/library/types'; +import type {SocketEventName} from './Pusher/library/types'; import * as Pusher from './Pusher/pusher'; -import {EventCallbackError, States} from './Pusher/pusher'; +import type {EventCallbackError, States} from './Pusher/pusher'; function init() { /** diff --git a/src/libs/PusherUtils.ts b/src/libs/PusherUtils.ts index 9f7e21ef9005..1ee75eb9c2f6 100644 --- a/src/libs/PusherUtils.ts +++ b/src/libs/PusherUtils.ts @@ -1,10 +1,10 @@ -import {OnyxUpdate} from 'react-native-onyx'; +import type {OnyxUpdate} from 'react-native-onyx'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; import Log from './Log'; import NetworkConnection from './NetworkConnection'; import * as Pusher from './Pusher/pusher'; -import {PushJSON} from './Pusher/pusher'; +import type {PushJSON} from './Pusher/pusher'; type Callback = (data: OnyxUpdate[]) => Promise; diff --git a/src/libs/ReceiptUtils.ts b/src/libs/ReceiptUtils.ts index 1151b559746d..1adb5957587b 100644 --- a/src/libs/ReceiptUtils.ts +++ b/src/libs/ReceiptUtils.ts @@ -1,12 +1,12 @@ import Str from 'expensify-common/lib/str'; -import {ImageSourcePropType} from 'react-native'; +import type {ImageSourcePropType} from 'react-native'; import ReceiptDoc from '@assets/images/receipt-doc.png'; import ReceiptGeneric from '@assets/images/receipt-generic.png'; import ReceiptHTML from '@assets/images/receipt-html.png'; import ReceiptSVG from '@assets/images/receipt-svg.png'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; -import {Transaction} from '@src/types/onyx'; +import type {Transaction} from '@src/types/onyx'; import * as FileUtils from './fileDownload/FileUtils'; type ThumbnailAndImageURI = { @@ -66,7 +66,7 @@ function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string image = ReceiptSVG; } - const isLocalFile = path.startsWith('blob:') || path.startsWith('file:'); + const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:'); return {thumbnail: image, image: path, isLocalFile}; } diff --git a/src/libs/ReportActionComposeFocusManager.ts b/src/libs/ReportActionComposeFocusManager.ts index 9d4039117989..123d97987e14 100644 --- a/src/libs/ReportActionComposeFocusManager.ts +++ b/src/libs/ReportActionComposeFocusManager.ts @@ -1,5 +1,5 @@ import React from 'react'; -import {TextInput} from 'react-native'; +import type {TextInput} from 'react-native'; import ROUTES from '@src/ROUTES'; import Navigation from './Navigation/Navigation'; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 34477d7f71ef..c8b7e673aed4 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1,20 +1,23 @@ import _ from 'lodash'; import lodashFindLast from 'lodash/findLast'; -import Onyx, {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import OnyxUtils from 'react-native-onyx/lib/utils'; -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {ActionName, ChangeLog} from '@src/types/onyx/OriginalMessage'; -import Report from '@src/types/onyx/Report'; -import ReportAction, {Message, ReportActions} from '@src/types/onyx/ReportAction'; -import {EmptyObject, isEmptyObject} from '@src/types/utils/EmptyObject'; +import type {ActionName, ChangeLog} from '@src/types/onyx/OriginalMessage'; +import type Report from '@src/types/onyx/Report'; +import type {Message, ReportActions} from '@src/types/onyx/ReportAction'; +import type ReportAction from '@src/types/onyx/ReportAction'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; import * as CollectionUtils from './CollectionUtils'; import * as Environment from './Environment/Environment'; import isReportMessageAttachment from './isReportMessageAttachment'; import * as Localize from './Localize'; import Log from './Log'; -import {MessageElementBase, MessageTextElement} from './MessageElement'; +import type {MessageElementBase, MessageTextElement} from './MessageElement'; import * as PersonalDetailsUtils from './PersonalDetailsUtils'; type LastVisibleMessage = { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 470d9f3392d3..848dfecfe4bf 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5,24 +5,26 @@ import lodashEscape from 'lodash/escape'; import lodashFindLastIndex from 'lodash/findLastIndex'; import lodashIntersection from 'lodash/intersection'; import lodashIsEqual from 'lodash/isEqual'; -import Onyx, {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import * as Expensicons from '@components/Icon/Expensicons'; import * as defaultWorkspaceAvatars from '@components/Icon/WorkspaceDefaultAvatars'; import CONST from '@src/CONST'; -import {ParentNavigationSummaryParams, TranslationPaths} from '@src/languages/types'; +import type {ParentNavigationSummaryParams, TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import {Beta, Login, PersonalDetails, PersonalDetailsList, Policy, Report, ReportAction, ReportMetadata, Session, Transaction} from '@src/types/onyx'; -import {Errors, Icon, PendingAction} from '@src/types/onyx/OnyxCommon'; -import {IOUMessage, OriginalMessageActionName, OriginalMessageCreated} from '@src/types/onyx/OriginalMessage'; -import {Status} from '@src/types/onyx/PersonalDetails'; -import {NotificationPreference} from '@src/types/onyx/Report'; -import {Message, ReportActionBase, ReportActions} from '@src/types/onyx/ReportAction'; -import {Receipt, WaypointCollection} from '@src/types/onyx/Transaction'; -import DeepValueOf from '@src/types/utils/DeepValueOf'; -import {EmptyObject, isEmptyObject, isNotEmptyObject} from '@src/types/utils/EmptyObject'; -import IconAsset from '@src/types/utils/IconAsset'; +import type {Beta, Login, PersonalDetails, PersonalDetailsList, Policy, Report, ReportAction, ReportMetadata, Session, Transaction} from '@src/types/onyx'; +import type {Errors, Icon, PendingAction} from '@src/types/onyx/OnyxCommon'; +import type {IOUMessage, OriginalMessageActionName, OriginalMessageCreated} from '@src/types/onyx/OriginalMessage'; +import type {Status} from '@src/types/onyx/PersonalDetails'; +import type {NotificationPreference} from '@src/types/onyx/Report'; +import type {Message, ReportActionBase, ReportActions} from '@src/types/onyx/ReportAction'; +import type {Receipt, WaypointCollection} from '@src/types/onyx/Transaction'; +import type DeepValueOf from '@src/types/utils/DeepValueOf'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; +import {isEmptyObject, isNotEmptyObject} from '@src/types/utils/EmptyObject'; +import type IconAsset from '@src/types/utils/IconAsset'; import * as CurrencyUtils from './CurrencyUtils'; import DateUtils from './DateUtils'; import isReportMessageAttachment from './isReportMessageAttachment'; @@ -35,7 +37,7 @@ import Permissions from './Permissions'; import * as PersonalDetailsUtils from './PersonalDetailsUtils'; import * as PolicyUtils from './PolicyUtils'; import * as ReportActionsUtils from './ReportActionsUtils'; -import {LastVisibleMessage} from './ReportActionsUtils'; +import type {LastVisibleMessage} from './ReportActionsUtils'; import * as TransactionUtils from './TransactionUtils'; import * as Url from './Url'; import * as UserUtils from './UserUtils'; @@ -1847,7 +1849,7 @@ function getTransactionDetails(transaction: OnyxEntry, createdDateF * - the current user is the requestor and is not settled yet * - or the user is an admin on the policy the expense report is tied to */ -function canEditMoneyRequest(reportAction: OnyxEntry, fieldToEdit = ''): boolean { +function canEditMoneyRequest(reportAction: OnyxEntry, fieldToEdit = '', transaction?: OnyxEntry): boolean { const isDeleted = ReportActionsUtils.isDeletedAction(reportAction); if (isDeleted) { @@ -1874,11 +1876,14 @@ function canEditMoneyRequest(reportAction: OnyxEntry, fieldToEdit const isApproved = isReportApproved(moneyRequestReport); const isAdmin = isExpenseReport(moneyRequestReport) && (getPolicy(moneyRequestReport?.policyID ?? '')?.role ?? '') === CONST.POLICY.ROLE.ADMIN; const isRequestor = currentUserAccountID === reportAction?.actorAccountID; + const isDistanceRequest = !isEmpty(transaction) && TransactionUtils.isDistanceRequest(transaction); if (isAdmin && !isRequestor && fieldToEdit === CONST.EDIT_REQUEST_FIELD.RECEIPT) { return false; } - + if (isDistanceRequest && fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT) { + return isAdmin; + } if (isAdmin) { return true; } @@ -1906,7 +1911,7 @@ function canEditFieldOfMoneyRequest( ]; // Checks if this user has permissions to edit this money request - if (!canEditMoneyRequest(reportAction, fieldToEdit)) { + if (!canEditMoneyRequest(reportAction, fieldToEdit, transaction)) { return false; // User doesn't have permission to edit } if (!isEmpty(transaction) && fieldToEdit === CONST.EDIT_REQUEST_FIELD.RECEIPT && TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction)) { diff --git a/src/libs/Request.ts b/src/libs/Request.ts index 18fadca467ad..aa94eccbca2e 100644 --- a/src/libs/Request.ts +++ b/src/libs/Request.ts @@ -1,7 +1,7 @@ -import Request from '@src/types/onyx/Request'; -import Response from '@src/types/onyx/Response'; +import type Request from '@src/types/onyx/Request'; +import type Response from '@src/types/onyx/Response'; import HttpUtils from './HttpUtils'; -import Middleware from './Middleware/types'; +import type Middleware from './Middleware/types'; import enhanceParameters from './Network/enhanceParameters'; import * as NetworkStore from './Network/NetworkStore'; diff --git a/src/libs/SelectionScraper/index.native.ts b/src/libs/SelectionScraper/index.native.ts index 7712906f05e6..aeb9c5ae3ce2 100644 --- a/src/libs/SelectionScraper/index.native.ts +++ b/src/libs/SelectionScraper/index.native.ts @@ -1,4 +1,4 @@ -import GetCurrentSelection from './types'; +import type GetCurrentSelection from './types'; // This is a no-op function for native devices because they wouldn't be able to support Selection API like a website. const getCurrentSelection: GetCurrentSelection = () => ''; diff --git a/src/libs/SelectionScraper/index.ts b/src/libs/SelectionScraper/index.ts index 01b9db4b4a43..955fe693c856 100644 --- a/src/libs/SelectionScraper/index.ts +++ b/src/libs/SelectionScraper/index.ts @@ -1,9 +1,10 @@ import render from 'dom-serializer'; -import {DataNode, Element, Node} from 'domhandler'; +import type {Node} from 'domhandler'; +import {DataNode, Element} from 'domhandler'; import Str from 'expensify-common/lib/str'; import {parseDocument} from 'htmlparser2'; import CONST from '@src/CONST'; -import GetCurrentSelection from './types'; +import type GetCurrentSelection from './types'; const markdownElements = ['h1', 'strong', 'em', 'del', 'blockquote', 'q', 'code', 'pre', 'a', 'br', 'li', 'ul', 'ol', 'b', 'i', 's']; const tagAttribute = 'data-testid'; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 0a776645a393..64b0f13e90b6 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -1,15 +1,17 @@ /* eslint-disable rulesdir/prefer-underscore-method */ import Str from 'expensify-common/lib/str'; -import Onyx, {OnyxCollection} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {OnyxCollection} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {PersonalDetails} from '@src/types/onyx'; -import Beta from '@src/types/onyx/Beta'; -import * as OnyxCommon from '@src/types/onyx/OnyxCommon'; -import Policy from '@src/types/onyx/Policy'; -import Report from '@src/types/onyx/Report'; -import ReportAction, {ReportActions} from '@src/types/onyx/ReportAction'; +import type {PersonalDetails} from '@src/types/onyx'; +import type Beta from '@src/types/onyx/Beta'; +import type * as OnyxCommon from '@src/types/onyx/OnyxCommon'; +import type Policy from '@src/types/onyx/Policy'; +import type Report from '@src/types/onyx/Report'; +import type {ReportActions} from '@src/types/onyx/ReportAction'; +import type ReportAction from '@src/types/onyx/ReportAction'; import * as CollectionUtils from './CollectionUtils'; import * as LocalePhoneNumber from './LocalePhoneNumber'; import * as Localize from './Localize'; @@ -274,6 +276,7 @@ function getOptionData( isExpenseRequest: false, isWaitingOnBankAccount: false, isAllowedToComment: true, + isDeletedParentAction: false, }; const participantPersonalDetailList: PersonalDetails[] = Object.values(OptionsListUtils.getPersonalDetailsForAccountIDs(report.participantAccountIDs ?? [], personalDetails)); const personalDetail = participantPersonalDetailList[0] ?? {}; @@ -309,6 +312,7 @@ function getOptionData( result.notificationPreference = report.notificationPreference; result.isAllowedToComment = ReportUtils.canUserPerformWriteAction(report); result.chatType = report.chatType; + result.isDeletedParentAction = report.isDeletedParentAction; const hasMultipleParticipants = participantPersonalDetailList.length > 1 || result.isChatRoom || result.isPolicyExpenseChat || ReportUtils.isExpenseReport(report); const subtitle = ReportUtils.getChatRoomSubtitle(report); diff --git a/src/libs/StartupTimer/index.native.ts b/src/libs/StartupTimer/index.native.ts index 52ba55076fc1..8aa185d81146 100644 --- a/src/libs/StartupTimer/index.native.ts +++ b/src/libs/StartupTimer/index.native.ts @@ -1,5 +1,5 @@ import {NativeModules} from 'react-native'; -import StartupTimer from './types'; +import type StartupTimer from './types'; /** * Stop the startup trace for the app. diff --git a/src/libs/StartupTimer/index.ts b/src/libs/StartupTimer/index.ts index 1cc656b329f4..85960bcce24b 100644 --- a/src/libs/StartupTimer/index.ts +++ b/src/libs/StartupTimer/index.ts @@ -1,7 +1,7 @@ /** * Web noop as there is no "startup" to time from the native layer. */ -import StartupTimer from './types'; +import type StartupTimer from './types'; const startupTimer: StartupTimer = { stop: () => {}, diff --git a/src/libs/TaskUtils.ts b/src/libs/TaskUtils.ts index 3026e33edc8c..da2727d29942 100644 --- a/src/libs/TaskUtils.ts +++ b/src/libs/TaskUtils.ts @@ -1,8 +1,9 @@ -import Onyx, {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Report} from '@src/types/onyx'; -import ReportAction from '@src/types/onyx/ReportAction'; +import type {Report} from '@src/types/onyx'; +import type ReportAction from '@src/types/onyx/ReportAction'; import * as CollectionUtils from './CollectionUtils'; import * as Localize from './Localize'; diff --git a/src/libs/TransactionUtils.ts b/src/libs/TransactionUtils.ts index 615bea7ff18d..c34a6753c1d5 100644 --- a/src/libs/TransactionUtils.ts +++ b/src/libs/TransactionUtils.ts @@ -1,12 +1,14 @@ import lodashHas from 'lodash/has'; -import Onyx, {OnyxCollection, OnyxEntry} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {RecentWaypoint, Report, ReportAction, Transaction} from '@src/types/onyx'; -import PolicyTaxRate, {PolicyTaxRates} from '@src/types/onyx/PolicyTaxRates'; -import {Comment, Receipt, Waypoint, WaypointCollection} from '@src/types/onyx/Transaction'; -import {EmptyObject} from '@src/types/utils/EmptyObject'; +import type {RecentWaypoint, Report, ReportAction, Transaction} from '@src/types/onyx'; +import type {PolicyTaxRates} from '@src/types/onyx/PolicyTaxRates'; +import type PolicyTaxRate from '@src/types/onyx/PolicyTaxRates'; +import type {Comment, Receipt, Waypoint, WaypointCollection} from '@src/types/onyx/Transaction'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isCorporateCard, isExpensifyCard} from './CardUtils'; import DateUtils from './DateUtils'; import * as NumberUtils from './NumberUtils'; diff --git a/src/libs/Trie/index.ts b/src/libs/Trie/index.ts index c3c5aa4bbf3f..c23c7b814a22 100644 --- a/src/libs/Trie/index.ts +++ b/src/libs/Trie/index.ts @@ -1,4 +1,5 @@ -import TrieNode, {MetaData} from './TrieNode'; +import type {MetaData} from './TrieNode'; +import TrieNode from './TrieNode'; type Word = { name: string; diff --git a/src/libs/UnreadIndicatorUpdater/index.ts b/src/libs/UnreadIndicatorUpdater/index.ts index da45057bc46d..4126f2af4e83 100644 --- a/src/libs/UnreadIndicatorUpdater/index.ts +++ b/src/libs/UnreadIndicatorUpdater/index.ts @@ -1,8 +1,9 @@ -import Onyx, {OnyxCollection} from 'react-native-onyx'; +import type {OnyxCollection} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import * as ReportUtils from '@libs/ReportUtils'; import Navigation, {navigationRef} from '@navigation/Navigation'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Report} from '@src/types/onyx'; +import type {Report} from '@src/types/onyx'; import updateUnread from './updateUnread'; let allReports: OnyxCollection = {}; diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts index bd7b2cbc4752..2c79573ef906 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts @@ -1,4 +1,4 @@ -import UpdateUnread from './types'; +import type UpdateUnread from './types'; // Android does not yet implement this const updateUnread: UpdateUnread = () => {}; diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts index e5d2fca43bf4..5cbba61542b1 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts @@ -1,5 +1,5 @@ import ELECTRON_EVENTS from '../../../../desktop/ELECTRON_EVENTS'; -import UpdateUnread from './types'; +import type UpdateUnread from './types'; /** * Set the badge on desktop diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.ts index d6fac7c7771d..fcaa1cf57502 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.ts +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.ts @@ -1,5 +1,5 @@ import Airship from '@ua/react-native-airship'; -import UpdateUnread from './types'; +import type UpdateUnread from './types'; /** * Set the App Icon badge with the number of diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts index 46015f4e5e03..8e5f7d971903 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts @@ -2,7 +2,7 @@ * Web browsers have a tab title and favicon which can be updated to show there are unread comments */ import CONFIG from '@src/CONFIG'; -import UpdateUnread from './types'; +import type UpdateUnread from './types'; let unreadTotalCount = 0; /** diff --git a/src/libs/UserUtils.ts b/src/libs/UserUtils.ts index a5c2c05f39a6..653acfa36216 100644 --- a/src/libs/UserUtils.ts +++ b/src/libs/UserUtils.ts @@ -1,14 +1,15 @@ import Str from 'expensify-common/lib/str'; import _ from 'lodash'; -import Onyx, {OnyxEntry} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import * as defaultAvatars from '@components/Icon/DefaultAvatars'; import {ConciergeAvatar, FallbackAvatar} from '@components/Icon/Expensicons'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {PersonalDetailsList} from '@src/types/onyx'; -import Login from '@src/types/onyx/Login'; -import IconAsset from '@src/types/utils/IconAsset'; +import type {PersonalDetailsList} from '@src/types/onyx'; +import type Login from '@src/types/onyx/Login'; +import type IconAsset from '@src/types/utils/IconAsset'; import hashCode from './hashCode'; type AvatarRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24; diff --git a/src/libs/ValidationUtils.ts b/src/libs/ValidationUtils.ts index ba977312fcfb..4b973d95d136 100644 --- a/src/libs/ValidationUtils.ts +++ b/src/libs/ValidationUtils.ts @@ -5,8 +5,8 @@ import isDate from 'lodash/isDate'; import isEmpty from 'lodash/isEmpty'; import isObject from 'lodash/isObject'; import CONST from '@src/CONST'; -import {Report} from '@src/types/onyx'; -import * as OnyxCommon from '@src/types/onyx/OnyxCommon'; +import type {Report} from '@src/types/onyx'; +import type * as OnyxCommon from '@src/types/onyx/OnyxCommon'; import * as CardUtils from './CardUtils'; import DateUtils from './DateUtils'; import * as LoginUtils from './LoginUtils'; diff --git a/src/libs/ViolationsUtils.ts b/src/libs/ViolationsUtils.ts index 4cfa259c9e78..2637686e726b 100644 --- a/src/libs/ViolationsUtils.ts +++ b/src/libs/ViolationsUtils.ts @@ -1,7 +1,9 @@ import reject from 'lodash/reject'; import Onyx from 'react-native-onyx'; +import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; -import {PolicyCategories, PolicyTags, Transaction, TransactionViolation} from '@src/types/onyx'; +import type {PolicyCategories, PolicyTags, Transaction, TransactionViolation} from '@src/types/onyx'; +import type {Phrase, PhraseParameters} from './Localize'; const ViolationsUtils = { /** @@ -80,6 +82,104 @@ const ViolationsUtils = { value: newTransactionViolations, }; }, + /** + * Gets the translated message for each violation type. + * + * Necessary because `translate` throws a type error if you attempt to pass it a template strings, when the + * possible values could be either translation keys that resolve to strings or translation keys that resolve to + * functions. + */ + getViolationTranslation( + violation: TransactionViolation, + translate: (phraseKey: TKey, ...phraseParameters: PhraseParameters>) => string, + ): string { + switch (violation.name) { + case 'allTagLevelsRequired': + return translate('violations.allTagLevelsRequired'); + case 'autoReportedRejectedExpense': + return translate('violations.autoReportedRejectedExpense', { + rejectedBy: violation.data?.rejectedBy ?? '', + rejectReason: violation.data?.rejectReason ?? '', + }); + case 'billableExpense': + return translate('violations.billableExpense'); + case 'cashExpenseWithNoReceipt': + return translate('violations.cashExpenseWithNoReceipt', {amount: violation.data?.amount ?? ''}); + case 'categoryOutOfPolicy': + return translate('violations.categoryOutOfPolicy'); + case 'conversionSurcharge': + return translate('violations.conversionSurcharge', {surcharge: violation.data?.surcharge}); + case 'customUnitOutOfPolicy': + return translate('violations.customUnitOutOfPolicy'); + case 'duplicatedTransaction': + return translate('violations.duplicatedTransaction'); + case 'fieldRequired': + return translate('violations.fieldRequired'); + case 'futureDate': + return translate('violations.futureDate'); + case 'invoiceMarkup': + return translate('violations.invoiceMarkup', {invoiceMarkup: violation.data?.invoiceMarkup}); + case 'maxAge': + return translate('violations.maxAge', {maxAge: violation.data?.maxAge ?? 0}); + case 'missingCategory': + return translate('violations.missingCategory'); + case 'missingComment': + return translate('violations.missingComment'); + case 'missingTag': + return translate('violations.missingTag', {tagName: violation.data?.tagName}); + case 'modifiedAmount': + return translate('violations.modifiedAmount'); + case 'modifiedDate': + return translate('violations.modifiedDate'); + case 'nonExpensiworksExpense': + return translate('violations.nonExpensiworksExpense'); + case 'overAutoApprovalLimit': + return translate('violations.overAutoApprovalLimit', {formattedLimitAmount: violation.data?.formattedLimitAmount ?? ''}); + case 'overCategoryLimit': + return translate('violations.overCategoryLimit', {categoryLimit: violation.data?.categoryLimit ?? ''}); + case 'overLimit': + return translate('violations.overLimit', {amount: violation.data?.amount ?? ''}); + case 'overLimitAttendee': + return translate('violations.overLimitAttendee', {amount: violation.data?.amount ?? ''}); + case 'perDayLimit': + return translate('violations.perDayLimit', {limit: violation.data?.limit ?? ''}); + case 'receiptNotSmartScanned': + return translate('violations.receiptNotSmartScanned'); + case 'receiptRequired': + return translate('violations.receiptRequired', { + amount: violation.data?.amount ?? '0', + category: violation.data?.category ?? '', + }); + case 'rter': + return translate('violations.rter', { + brokenBankConnection: violation.data?.brokenBankConnection ?? false, + isAdmin: violation.data?.isAdmin ?? false, + email: violation.data?.email, + isTransactionOlderThan7Days: Boolean(violation.data?.isTransactionOlderThan7Days), + member: violation.data?.member, + }); + case 'smartscanFailed': + return translate('violations.smartscanFailed'); + case 'someTagLevelsRequired': + return translate('violations.someTagLevelsRequired'); + case 'tagOutOfPolicy': + return translate('violations.tagOutOfPolicy', {tagName: violation.data?.tagName}); + case 'taxAmountChanged': + return translate('violations.taxAmountChanged'); + case 'taxOutOfPolicy': + return translate('violations.taxOutOfPolicy', {taxName: violation.data?.taxName}); + case 'taxRateChanged': + return translate('violations.taxRateChanged'); + case 'taxRequired': + return translate('violations.taxRequired'); + default: + // The interpreter should never get here because the switch cases should be exhaustive. + // If typescript is showing an error on the assertion below it means the switch statement is out of + // sync with the `ViolationNames` type, and one or the other needs to be updated. + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + return violation.name as never; + } + }, }; export default ViolationsUtils; diff --git a/src/libs/Visibility/index.desktop.ts b/src/libs/Visibility/index.desktop.ts index bdc8b9a4267a..c01b6001f456 100644 --- a/src/libs/Visibility/index.desktop.ts +++ b/src/libs/Visibility/index.desktop.ts @@ -1,5 +1,5 @@ import ELECTRON_EVENTS from '../../../desktop/ELECTRON_EVENTS'; -import {HasFocus, IsVisible, OnVisibilityChange} from './types'; +import type {HasFocus, IsVisible, OnVisibilityChange} from './types'; /** * Detects whether the app is visible or not. Electron supports document.visibilityState, diff --git a/src/libs/Visibility/index.native.ts b/src/libs/Visibility/index.native.ts index 42bd56531207..bedcce101d61 100644 --- a/src/libs/Visibility/index.native.ts +++ b/src/libs/Visibility/index.native.ts @@ -1,7 +1,7 @@ // Mobile apps do not require this check for visibility as // they do not use the Notification lib. import {AppState} from 'react-native'; -import {HasFocus, IsVisible, OnVisibilityChange} from './types'; +import type {HasFocus, IsVisible, OnVisibilityChange} from './types'; const isVisible: IsVisible = () => AppState.currentState === 'active'; diff --git a/src/libs/Visibility/index.ts b/src/libs/Visibility/index.ts index 4cf18b010a07..e7556fa22eb4 100644 --- a/src/libs/Visibility/index.ts +++ b/src/libs/Visibility/index.ts @@ -1,5 +1,5 @@ import {AppState} from 'react-native'; -import {HasFocus, IsVisible, OnVisibilityChange} from './types'; +import type {HasFocus, IsVisible, OnVisibilityChange} from './types'; /** * Detects whether the app is visible or not. diff --git a/src/libs/VisualViewport/index.native.ts b/src/libs/VisualViewport/index.native.ts index a50b080d9aab..6b6d3338f472 100644 --- a/src/libs/VisualViewport/index.native.ts +++ b/src/libs/VisualViewport/index.native.ts @@ -1,4 +1,4 @@ -import AddViewportResizeListener from './types'; +import type AddViewportResizeListener from './types'; /** * Visual Viewport is not available on native, so return an empty function. diff --git a/src/libs/VisualViewport/index.ts b/src/libs/VisualViewport/index.ts index e24d42f272a4..78a4743c9fa7 100644 --- a/src/libs/VisualViewport/index.ts +++ b/src/libs/VisualViewport/index.ts @@ -1,4 +1,4 @@ -import AddViewportResizeListener from './types'; +import type AddViewportResizeListener from './types'; /** * Add a visual viewport resize listener if available. Return a function to remove the listener. diff --git a/src/libs/__mocks__/Permissions.ts b/src/libs/__mocks__/Permissions.ts index 4f47c0b756b7..759392bde2c6 100644 --- a/src/libs/__mocks__/Permissions.ts +++ b/src/libs/__mocks__/Permissions.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import Beta from '@src/types/onyx/Beta'; +import type Beta from '@src/types/onyx/Beta'; /** * This module is mocked in tests because all the permission methods call canUseAllBetas() and that will diff --git a/src/libs/actions/App.ts b/src/libs/actions/App.ts index ec43d4358134..f88bfe09e516 100644 --- a/src/libs/actions/App.ts +++ b/src/libs/actions/App.ts @@ -1,8 +1,10 @@ // Issue - https://github.com/Expensify/App/issues/26719 import Str from 'expensify-common/lib/str'; -import {AppState, AppStateStatus} from 'react-native'; -import Onyx, {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {AppStateStatus} from 'react-native'; +import {AppState} from 'react-native'; +import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import * as API from '@libs/API'; import * as Browser from '@libs/Browser'; import Log from '@libs/Log'; @@ -13,9 +15,10 @@ import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as SessionUtils from '@libs/SessionUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES, {Route} from '@src/ROUTES'; -import * as OnyxTypes from '@src/types/onyx'; -import {SelectedTimezone} from '@src/types/onyx/PersonalDetails'; +import type {Route} from '@src/ROUTES'; +import ROUTES from '@src/ROUTES'; +import type * as OnyxTypes from '@src/types/onyx'; +import type {SelectedTimezone} from '@src/types/onyx/PersonalDetails'; import type {OnyxData} from '@src/types/onyx/Request'; import * as Policy from './Policy'; import * as Session from './Session'; diff --git a/src/libs/actions/Chronos.ts b/src/libs/actions/Chronos.ts index 76308f225fe4..0bb949687e6d 100644 --- a/src/libs/actions/Chronos.ts +++ b/src/libs/actions/Chronos.ts @@ -1,8 +1,9 @@ -import Onyx, {OnyxUpdate} from 'react-native-onyx'; +import type {OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import * as API from '@libs/API'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {ChronosOOOEvent} from '@src/types/onyx/OriginalMessage'; +import type {ChronosOOOEvent} from '@src/types/onyx/OriginalMessage'; const removeEvent = (reportID: string, reportActionID: string, eventID: string, events: ChronosOOOEvent[]) => { const optimisticData: OnyxUpdate[] = [ diff --git a/src/libs/actions/Device/generateDeviceID/index.android.ts b/src/libs/actions/Device/generateDeviceID/index.android.ts index 5fadc63ac3ba..d662967a9f76 100644 --- a/src/libs/actions/Device/generateDeviceID/index.android.ts +++ b/src/libs/actions/Device/generateDeviceID/index.android.ts @@ -1,6 +1,6 @@ import Str from 'expensify-common/lib/str'; import DeviceInfo from 'react-native-device-info'; -import GenerateDeviceID from './types'; +import type GenerateDeviceID from './types'; const deviceID = DeviceInfo.getDeviceId(); const uniqueID = Str.guid(deviceID); diff --git a/src/libs/actions/Device/generateDeviceID/index.desktop.ts b/src/libs/actions/Device/generateDeviceID/index.desktop.ts index a5e1acdc40fd..f8af0a7faa81 100644 --- a/src/libs/actions/Device/generateDeviceID/index.desktop.ts +++ b/src/libs/actions/Device/generateDeviceID/index.desktop.ts @@ -1,5 +1,5 @@ import ELECTRON_EVENTS from '../../../../../desktop/ELECTRON_EVENTS'; -import GenerateDeviceID from './types'; +import type GenerateDeviceID from './types'; /** * Get the unique ID of the current device. This should remain the same even if the user uninstalls and reinstalls the app. diff --git a/src/libs/actions/Device/generateDeviceID/index.ios.ts b/src/libs/actions/Device/generateDeviceID/index.ios.ts index 6567ffffb8d3..a63d176a77d1 100644 --- a/src/libs/actions/Device/generateDeviceID/index.ios.ts +++ b/src/libs/actions/Device/generateDeviceID/index.ios.ts @@ -1,5 +1,5 @@ import DeviceInfo from 'react-native-device-info'; -import GenerateDeviceID from './types'; +import type GenerateDeviceID from './types'; const deviceID = DeviceInfo.getDeviceId(); diff --git a/src/libs/actions/Device/generateDeviceID/index.ts b/src/libs/actions/Device/generateDeviceID/index.ts index b7011b7bb2d9..82ea72ba8180 100644 --- a/src/libs/actions/Device/generateDeviceID/index.ts +++ b/src/libs/actions/Device/generateDeviceID/index.ts @@ -1,5 +1,5 @@ import Str from 'expensify-common/lib/str'; -import GenerateDeviceID from './types'; +import type GenerateDeviceID from './types'; const uniqueID = Str.guid(); diff --git a/src/libs/actions/Device/getDeviceInfo/getBaseInfo.ts b/src/libs/actions/Device/getDeviceInfo/getBaseInfo.ts index aa5ef00815d2..28dc7b10c8d0 100644 --- a/src/libs/actions/Device/getDeviceInfo/getBaseInfo.ts +++ b/src/libs/actions/Device/getDeviceInfo/getBaseInfo.ts @@ -1,5 +1,5 @@ import packageConfig from '../../../../../package.json'; -import {GetBaseInfo} from './types'; +import type {GetBaseInfo} from './types'; const getBaseInfo: GetBaseInfo = () => ({ appVersion: packageConfig.version, diff --git a/src/libs/actions/Device/getDeviceInfo/getOSAndName/index.native.ts b/src/libs/actions/Device/getDeviceInfo/getOSAndName/index.native.ts index bfce98b1c65e..16a48348df71 100644 --- a/src/libs/actions/Device/getDeviceInfo/getOSAndName/index.native.ts +++ b/src/libs/actions/Device/getDeviceInfo/getOSAndName/index.native.ts @@ -1,6 +1,6 @@ import Str from 'expensify-common/lib/str'; import RNDeviceInfo from 'react-native-device-info'; -import {GetOSAndName} from './types'; +import type {GetOSAndName} from './types'; const getOSAndName: GetOSAndName = () => { const deviceName = RNDeviceInfo.getDeviceNameSync(); diff --git a/src/libs/actions/Device/getDeviceInfo/index.android.ts b/src/libs/actions/Device/getDeviceInfo/index.android.ts index 6d8e9e497145..8ac243afa0dc 100644 --- a/src/libs/actions/Device/getDeviceInfo/index.android.ts +++ b/src/libs/actions/Device/getDeviceInfo/index.android.ts @@ -1,6 +1,6 @@ import getBaseInfo from './getBaseInfo'; import getOSAndName from './getOSAndName/index'; -import {GetDeviceInfo} from './types'; +import type {GetDeviceInfo} from './types'; const getDeviceInfo: GetDeviceInfo = () => ({ ...getBaseInfo(), diff --git a/src/libs/actions/Device/getDeviceInfo/index.desktop.ts b/src/libs/actions/Device/getDeviceInfo/index.desktop.ts index cb99de08ae93..51afe5805ce9 100644 --- a/src/libs/actions/Device/getDeviceInfo/index.desktop.ts +++ b/src/libs/actions/Device/getDeviceInfo/index.desktop.ts @@ -1,6 +1,6 @@ import getBaseInfo from './getBaseInfo'; import getOSAndName from './getOSAndName/index'; -import {GetDeviceInfo} from './types'; +import type {GetDeviceInfo} from './types'; const getDeviceInfo: GetDeviceInfo = () => ({ ...getBaseInfo(), diff --git a/src/libs/actions/Device/getDeviceInfo/index.ios.ts b/src/libs/actions/Device/getDeviceInfo/index.ios.ts index b91d5236a084..b4974807272a 100644 --- a/src/libs/actions/Device/getDeviceInfo/index.ios.ts +++ b/src/libs/actions/Device/getDeviceInfo/index.ios.ts @@ -1,6 +1,6 @@ import getBaseInfo from './getBaseInfo'; import getOSAndName from './getOSAndName/index'; -import {GetDeviceInfo} from './types'; +import type {GetDeviceInfo} from './types'; const getDeviceInfo: GetDeviceInfo = () => ({ ...getBaseInfo(), diff --git a/src/libs/actions/Device/getDeviceInfo/index.ts b/src/libs/actions/Device/getDeviceInfo/index.ts index b82aafc56cbe..cd4c02646367 100644 --- a/src/libs/actions/Device/getDeviceInfo/index.ts +++ b/src/libs/actions/Device/getDeviceInfo/index.ts @@ -1,6 +1,6 @@ import getBaseInfo from './getBaseInfo'; import getOSAndName from './getOSAndName/index'; -import {GetDeviceInfo} from './types'; +import type {GetDeviceInfo} from './types'; const getDeviceInfo: GetDeviceInfo = () => ({ ...getBaseInfo(), diff --git a/src/libs/actions/Device/getDeviceInfo/types.ts b/src/libs/actions/Device/getDeviceInfo/types.ts index 684ef68f1359..4262a02f84b0 100644 --- a/src/libs/actions/Device/getDeviceInfo/types.ts +++ b/src/libs/actions/Device/getDeviceInfo/types.ts @@ -1,4 +1,4 @@ -import {OSAndName} from './getOSAndName/types'; +import type {OSAndName} from './getOSAndName/types'; type BaseInfo = { appVersion: string; diff --git a/src/libs/actions/EmojiPickerAction.ts b/src/libs/actions/EmojiPickerAction.ts index 0f9dd4b727aa..064c52f9b7ef 100644 --- a/src/libs/actions/EmojiPickerAction.ts +++ b/src/libs/actions/EmojiPickerAction.ts @@ -1,7 +1,7 @@ import React from 'react'; -import {View} from 'react-native'; -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {View} from 'react-native'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; type AnchorOrigin = { horizontal: ValueOf; diff --git a/src/libs/actions/FormActions.ts b/src/libs/actions/FormActions.ts index 29d9ecda9f73..6b73636e6d82 100644 --- a/src/libs/actions/FormActions.ts +++ b/src/libs/actions/FormActions.ts @@ -1,9 +1,9 @@ import Onyx from 'react-native-onyx'; -import {KeyValueMapping, NullishDeep} from 'react-native-onyx/lib/types'; +import type {KeyValueMapping, NullishDeep} from 'react-native-onyx/lib/types'; import FormUtils from '@libs/FormUtils'; -import {OnyxFormKey} from '@src/ONYXKEYS'; -import {Form} from '@src/types/onyx'; -import * as OnyxCommon from '@src/types/onyx/OnyxCommon'; +import type {OnyxFormKey} from '@src/ONYXKEYS'; +import type {Form} from '@src/types/onyx'; +import type * as OnyxCommon from '@src/types/onyx/OnyxCommon'; type ExcludeDraft = T extends `${string}Draft` ? never : T; type OnyxFormKeyWithoutDraft = ExcludeDraft; diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 4e24f46bf2d9..9d0eac49391b 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -182,14 +182,6 @@ function setMoneyRequestAmount_temporaryForRefactor(transactionID, amount, curre Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount, currency}); } -/** - * Reset the money request amount, discarding the user-provided value. In the case of distance requests, this will effectively re-enable the default behavior of automatic amount calculation. - * @param {String} transactionID - */ -function resetMoneyRequestAmount_temporaryForRefactor(transactionID) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount: CONST.IOU.DEFAULT_AMOUNT}); -} - /** * @param {String} transactionID * @param {String} created @@ -989,7 +981,10 @@ function getUpdateMoneyRequestParams(transactionID, transactionThreadReportID, t onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, value: { - [updatedReportAction.reportActionID]: updatedReportAction, + [updatedReportAction.reportActionID]: { + ...updatedReportAction, + errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericEditFailureMessage'), + }, }, }); @@ -3582,5 +3577,4 @@ export { detachReceipt, getIOUReportID, editMoneyRequest, - resetMoneyRequestAmount_temporaryForRefactor, }; diff --git a/src/libs/actions/Link.ts b/src/libs/actions/Link.ts index e6d33fec118d..2fb863467e32 100644 --- a/src/libs/actions/Link.ts +++ b/src/libs/actions/Link.ts @@ -7,7 +7,8 @@ import * as Url from '@libs/Url'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES, {Route} from '@src/ROUTES'; +import type {Route} from '@src/ROUTES'; +import ROUTES from '@src/ROUTES'; let isNetworkOffline = false; Onyx.connect({ diff --git a/src/libs/actions/MapboxToken.ts b/src/libs/actions/MapboxToken.ts index 4596e82a9354..54f99b58fbeb 100644 --- a/src/libs/actions/MapboxToken.ts +++ b/src/libs/actions/MapboxToken.ts @@ -1,11 +1,12 @@ import {isAfter} from 'date-fns'; -import {AppState, NativeEventSubscription} from 'react-native'; +import type {NativeEventSubscription} from 'react-native'; +import {AppState} from 'react-native'; import Onyx from 'react-native-onyx'; import * as ActiveClientManager from '@libs/ActiveClientManager'; import * as API from '@libs/API'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {MapboxAccessToken, Network} from '@src/types/onyx'; +import type {MapboxAccessToken, Network} from '@src/types/onyx'; let authToken: string | null; Onyx.connect({ diff --git a/src/libs/actions/OnyxUpdates.ts b/src/libs/actions/OnyxUpdates.ts index 6f9c98c91f9e..2291e6d0af4a 100644 --- a/src/libs/actions/OnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdates.ts @@ -1,11 +1,12 @@ -import Onyx, {OnyxEntry} from 'react-native-onyx'; -import {Merge} from 'type-fest'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {Merge} from 'type-fest'; import Log from '@libs/Log'; import PusherUtils from '@libs/PusherUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {OnyxUpdateEvent, OnyxUpdatesFromServer, Request} from '@src/types/onyx'; -import Response from '@src/types/onyx/Response'; +import type {OnyxUpdateEvent, OnyxUpdatesFromServer, Request} from '@src/types/onyx'; +import type Response from '@src/types/onyx/Response'; import * as QueuedOnyxUpdates from './QueuedOnyxUpdates'; // This key needs to be separate from ONYXKEYS.ONYX_UPDATES_FROM_SERVER so that it can be updated without triggering the callback when the server IDs are updated. If that diff --git a/src/libs/actions/PaymentMethods.ts b/src/libs/actions/PaymentMethods.ts index 3547a3053a02..a7ae54f46416 100644 --- a/src/libs/actions/PaymentMethods.ts +++ b/src/libs/actions/PaymentMethods.ts @@ -1,7 +1,8 @@ import {createRef} from 'react'; -import Onyx, {OnyxUpdate} from 'react-native-onyx'; -import {OnyxEntry} from 'react-native-onyx/lib/types'; -import {ValueOf} from 'type-fest'; +import type {OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx/lib/types'; +import type {ValueOf} from 'type-fest'; import * as API from '@libs/API'; import * as CardUtils from '@libs/CardUtils'; import Navigation from '@libs/Navigation/Navigation'; @@ -9,8 +10,8 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {BankAccountList, FundList} from '@src/types/onyx'; -import PaymentMethod from '@src/types/onyx/PaymentMethod'; -import {FilterMethodPaymentType} from '@src/types/onyx/WalletTransfer'; +import type PaymentMethod from '@src/types/onyx/PaymentMethod'; +import type {FilterMethodPaymentType} from '@src/types/onyx/WalletTransfer'; type KYCWallRef = { continueAction?: () => void; diff --git a/src/libs/actions/PersistedRequests.ts b/src/libs/actions/PersistedRequests.ts index 22242ed6cbc5..fcc6450c6072 100644 --- a/src/libs/actions/PersistedRequests.ts +++ b/src/libs/actions/PersistedRequests.ts @@ -1,7 +1,7 @@ import isEqual from 'lodash/isEqual'; import Onyx from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Request} from '@src/types/onyx'; +import type {Request} from '@src/types/onyx'; let persistedRequests: Request[] = []; diff --git a/src/libs/actions/PersonalDetails.ts b/src/libs/actions/PersonalDetails.ts index ff919f312987..20c6d8fef247 100644 --- a/src/libs/actions/PersonalDetails.ts +++ b/src/libs/actions/PersonalDetails.ts @@ -1,7 +1,8 @@ import Str from 'expensify-common/lib/str'; -import Onyx, {OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import type {OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import * as API from '@libs/API'; -import {CustomRNImageManipulatorResult} from '@libs/cropOrRotateImage/types'; +import type {CustomRNImageManipulatorResult} from '@libs/cropOrRotateImage/types'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import Navigation from '@libs/Navigation/Navigation'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; @@ -9,8 +10,8 @@ import * as UserUtils from '@libs/UserUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import {DateOfBirthForm, PersonalDetails, PersonalDetailsList, PrivatePersonalDetails} from '@src/types/onyx'; -import {SelectedTimezone, Timezone} from '@src/types/onyx/PersonalDetails'; +import type {DateOfBirthForm, PersonalDetails, PersonalDetailsList, PrivatePersonalDetails} from '@src/types/onyx'; +import type {SelectedTimezone, Timezone} from '@src/types/onyx/PersonalDetails'; type FirstAndLastName = { firstName: string; diff --git a/src/libs/actions/PriorityMode.ts b/src/libs/actions/PriorityMode.ts index d528c31d7453..1d38d09e08a1 100644 --- a/src/libs/actions/PriorityMode.ts +++ b/src/libs/actions/PriorityMode.ts @@ -1,10 +1,11 @@ import debounce from 'lodash/debounce'; -import Onyx, {OnyxCollection} from 'react-native-onyx'; +import type {OnyxCollection} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import * as CollectionUtils from '@libs/CollectionUtils'; import Log from '@libs/Log'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Report} from '@src/types/onyx'; +import type {Report} from '@src/types/onyx'; /** * This actions file is used to automatically switch a user into #focus mode when they exceed a certain number of reports. We do this primarily for performance reasons. diff --git a/src/libs/actions/QueuedOnyxUpdates.ts b/src/libs/actions/QueuedOnyxUpdates.ts index 1707bebd6cb2..83bc6652cb39 100644 --- a/src/libs/actions/QueuedOnyxUpdates.ts +++ b/src/libs/actions/QueuedOnyxUpdates.ts @@ -1,4 +1,5 @@ -import Onyx, {OnyxUpdate} from 'react-native-onyx'; +import type {OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; // In this file we manage a queue of Onyx updates while the SequentialQueue is processing. There are functions to get the updates and clear the queue after saving the updates in Onyx. diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index da0bfd9c058b..13e4222f942f 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3,10 +3,11 @@ import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import Str from 'expensify-common/lib/str'; import isEmpty from 'lodash/isEmpty'; import {DeviceEventEmitter, InteractionManager} from 'react-native'; -import Onyx, {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; -import {NullishDeep} from 'react-native-onyx/lib/types'; -import {PartialDeep, ValueOf} from 'type-fest'; -import {Emoji} from '@assets/emojis/types'; +import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {NullishDeep} from 'react-native-onyx/lib/types'; +import type {PartialDeep, ValueOf} from 'type-fest'; +import type {Emoji} from '@assets/emojis/types'; import * as ActiveClientManager from '@libs/ActiveClientManager'; import * as API from '@libs/API'; import * as CollectionUtils from '@libs/CollectionUtils'; @@ -28,12 +29,16 @@ import Visibility from '@libs/Visibility'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES, {Route} from '@src/ROUTES'; -import {PersonalDetails, PersonalDetailsList, ReportActionReactions, ReportUserIsTyping} from '@src/types/onyx'; -import {Decision, OriginalMessageIOU} from '@src/types/onyx/OriginalMessage'; -import Report, {NotificationPreference, WriteCapability} from '@src/types/onyx/Report'; -import ReportAction, {Message, ReportActionBase, ReportActions} from '@src/types/onyx/ReportAction'; -import {EmptyObject, isEmptyObject, isNotEmptyObject} from '@src/types/utils/EmptyObject'; +import type {Route} from '@src/ROUTES'; +import ROUTES from '@src/ROUTES'; +import type {PersonalDetails, PersonalDetailsList, ReportActionReactions, ReportUserIsTyping} from '@src/types/onyx'; +import type {Decision, OriginalMessageIOU} from '@src/types/onyx/OriginalMessage'; +import type {NotificationPreference, WriteCapability} from '@src/types/onyx/Report'; +import type Report from '@src/types/onyx/Report'; +import type {Message, ReportActionBase, ReportActions} from '@src/types/onyx/ReportAction'; +import type ReportAction from '@src/types/onyx/ReportAction'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; +import {isEmptyObject, isNotEmptyObject} from '@src/types/utils/EmptyObject'; import * as Session from './Session'; import * as Welcome from './Welcome'; diff --git a/src/libs/actions/ReportActions.ts b/src/libs/actions/ReportActions.ts index 7cd72fb4cd49..31f06a5f0372 100644 --- a/src/libs/actions/ReportActions.ts +++ b/src/libs/actions/ReportActions.ts @@ -3,7 +3,7 @@ import * as ReportActionUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ReportAction from '@src/types/onyx/ReportAction'; +import type ReportAction from '@src/types/onyx/ReportAction'; import * as Report from './Report'; function clearReportActionErrors(reportID: string, reportAction: ReportAction) { diff --git a/src/libs/actions/Session/clearCache/index.native.ts b/src/libs/actions/Session/clearCache/index.native.ts index ce2e6beafa9f..a89c5f4d4a1e 100644 --- a/src/libs/actions/Session/clearCache/index.native.ts +++ b/src/libs/actions/Session/clearCache/index.native.ts @@ -1,5 +1,5 @@ import {CachesDirectoryPath, unlink} from 'react-native-fs'; -import ClearCache from './types'; +import type ClearCache from './types'; // `unlink` is used to delete the caches directory const clearStorage: ClearCache = () => unlink(CachesDirectoryPath); diff --git a/src/libs/actions/Session/clearCache/index.ts b/src/libs/actions/Session/clearCache/index.ts index 2722d8636a75..6d288c6cbd3b 100644 --- a/src/libs/actions/Session/clearCache/index.ts +++ b/src/libs/actions/Session/clearCache/index.ts @@ -1,4 +1,4 @@ -import ClearCache from './types'; +import type ClearCache from './types'; const clearStorage: ClearCache = () => new Promise((res) => res()); diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index a667e054fb92..67f531bff505 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -1,9 +1,10 @@ import throttle from 'lodash/throttle'; -import {ChannelAuthorizationData} from 'pusher-js/types/src/core/auth/options'; -import {ChannelAuthorizationCallback} from 'pusher-js/with-encryption'; +import type {ChannelAuthorizationData} from 'pusher-js/types/src/core/auth/options'; +import type {ChannelAuthorizationCallback} from 'pusher-js/with-encryption'; import {Linking} from 'react-native'; -import Onyx, {OnyxUpdate} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; +import type {OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import * as PersistedRequests from '@libs/actions/PersistedRequests'; import * as API from '@libs/API'; import * as Authentication from '@libs/Authentication'; @@ -30,8 +31,8 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; -import Credentials from '@src/types/onyx/Credentials'; -import {AutoAuthState} from '@src/types/onyx/Session'; +import type Credentials from '@src/types/onyx/Credentials'; +import type {AutoAuthState} from '@src/types/onyx/Session'; import clearCache from './clearCache'; let sessionAuthTokenType: string | null = ''; diff --git a/src/libs/actions/SignInRedirect.ts b/src/libs/actions/SignInRedirect.ts index 6c9e7f55d887..ecb09ccd1804 100644 --- a/src/libs/actions/SignInRedirect.ts +++ b/src/libs/actions/SignInRedirect.ts @@ -1,6 +1,7 @@ import Onyx from 'react-native-onyx'; import * as ErrorUtils from '@libs/ErrorUtils'; -import ONYXKEYS, {OnyxKey} from '@src/ONYXKEYS'; +import type {OnyxKey} from '@src/ONYXKEYS'; +import ONYXKEYS from '@src/ONYXKEYS'; let currentIsOffline: boolean | undefined; let currentShouldForceOffline: boolean | undefined; diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index 31cfd96c0bd3..9122bba7e83e 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -392,6 +392,7 @@ function editTask(report, {title, description}) { ...(title && {reportName: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}), ...(description && {description: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}), }, + errorFields: null, }, }, ]; diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index 951851d72eb3..f8bfa5fe78fd 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -7,10 +7,9 @@ import * as CollectionUtils from '@libs/CollectionUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {RecentWaypoint, Transaction} from '@src/types/onyx'; -import {OnyxData} from '@src/types/onyx/Request'; -import {WaypointCollection} from '@src/types/onyx/Transaction'; -import * as IOU from './IOU'; +import type {RecentWaypoint, Transaction} from '@src/types/onyx'; +import type {OnyxData} from '@src/types/onyx/Request'; +import type {WaypointCollection} from '@src/types/onyx/Transaction'; let recentWaypoints: RecentWaypoint[] = []; Onyx.connect({ @@ -59,7 +58,6 @@ function addStop(transactionID: string) { } function saveWaypoint(transactionID: string, index: string, waypoint: RecentWaypoint | null, isDraft = false) { - IOU.resetMoneyRequestAmount_temporaryForRefactor(transactionID); Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION : ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, { comment: { waypoints: { @@ -102,7 +100,6 @@ function saveWaypoint(transactionID: string, index: string, waypoint: RecentWayp } function removeWaypoint(transaction: Transaction, currentIndex: string, isDraft: boolean) { - IOU.resetMoneyRequestAmount_temporaryForRefactor(transaction.transactionID); // Index comes from the route params and is a string const index = Number(currentIndex); const existingWaypoints = transaction?.comment?.waypoints ?? {}; @@ -243,7 +240,6 @@ function getRouteForDraft(transactionID: string, waypoints: WaypointCollection) * which will replace the existing ones. */ function updateWaypoints(transactionID: string, waypoints: WaypointCollection, isDraft = false): Promise { - IOU.resetMoneyRequestAmount_temporaryForRefactor(transactionID); return Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, { comment: { waypoints, diff --git a/src/libs/actions/TwoFactorAuthActions.ts b/src/libs/actions/TwoFactorAuthActions.ts index 26e402096aa6..c4b74836f9db 100644 --- a/src/libs/actions/TwoFactorAuthActions.ts +++ b/src/libs/actions/TwoFactorAuthActions.ts @@ -1,8 +1,9 @@ import Onyx from 'react-native-onyx'; import Navigation from '@libs/Navigation/Navigation'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES, {Route} from '@src/ROUTES'; -import {TwoFactorAuthStep} from '@src/types/onyx/Account'; +import type {Route} from '@src/ROUTES'; +import ROUTES from '@src/ROUTES'; +import type {TwoFactorAuthStep} from '@src/types/onyx/Account'; /** * Clear 2FA data if the flow is interrupted without finishing diff --git a/src/libs/actions/UserLocation.ts b/src/libs/actions/UserLocation.ts index 4c58f7a83284..699b701904e4 100644 --- a/src/libs/actions/UserLocation.ts +++ b/src/libs/actions/UserLocation.ts @@ -1,6 +1,6 @@ import Onyx from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; -import {UserLocation} from '@src/types/onyx'; +import type {UserLocation} from '@src/types/onyx'; /** * Sets the longitude and latitude of user's current location diff --git a/src/libs/actions/Welcome.ts b/src/libs/actions/Welcome.ts index 02109804efb9..5046449c7389 100644 --- a/src/libs/actions/Welcome.ts +++ b/src/libs/actions/Welcome.ts @@ -1,12 +1,13 @@ -import Onyx, {OnyxCollection} from 'react-native-onyx'; +import type {OnyxCollection} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; -import OnyxPolicy from '@src/types/onyx/Policy'; -import Report from '@src/types/onyx/Report'; +import type OnyxPolicy from '@src/types/onyx/Policy'; +import type Report from '@src/types/onyx/Report'; import * as Policy from './Policy'; let resolveIsReadyPromise: (value?: Promise) => void | undefined; diff --git a/src/libs/asyncOpenURL/index.ts b/src/libs/asyncOpenURL/index.ts index 5307049ee923..8fca6891e9d6 100644 --- a/src/libs/asyncOpenURL/index.ts +++ b/src/libs/asyncOpenURL/index.ts @@ -1,5 +1,5 @@ import {Linking} from 'react-native'; -import AsyncOpenURL from './types'; +import type AsyncOpenURL from './types'; const asyncOpenURL: AsyncOpenURL = (promise, url) => { if (!url) { diff --git a/src/libs/asyncOpenURL/index.website.ts b/src/libs/asyncOpenURL/index.website.ts index d503644c1392..b781c4f605cb 100644 --- a/src/libs/asyncOpenURL/index.website.ts +++ b/src/libs/asyncOpenURL/index.website.ts @@ -1,5 +1,5 @@ import {Linking} from 'react-native'; -import AsyncOpenURL from './types'; +import type AsyncOpenURL from './types'; /** * Prevents Safari from blocking pop-up window when opened within async call. diff --git a/src/libs/calculateAnchorPosition.ts b/src/libs/calculateAnchorPosition.ts index b9d0f553ca4f..66966b7b504c 100644 --- a/src/libs/calculateAnchorPosition.ts +++ b/src/libs/calculateAnchorPosition.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ -import {View} from 'react-native'; -import {ValueOf} from 'type-fest'; +import type {View} from 'react-native'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import type {AnchorPosition} from '@src/styles'; diff --git a/src/libs/canFocusInputOnScreenFocus/index.native.ts b/src/libs/canFocusInputOnScreenFocus/index.native.ts index 79d711c49fa6..d8a093573387 100644 --- a/src/libs/canFocusInputOnScreenFocus/index.native.ts +++ b/src/libs/canFocusInputOnScreenFocus/index.native.ts @@ -1,4 +1,4 @@ -import CanFocusInputOnScreenFocus from './types'; +import type CanFocusInputOnScreenFocus from './types'; const canFocusInputOnScreenFocus: CanFocusInputOnScreenFocus = () => false; diff --git a/src/libs/canFocusInputOnScreenFocus/index.ts b/src/libs/canFocusInputOnScreenFocus/index.ts index 57baac02245d..65cebd43cfe0 100644 --- a/src/libs/canFocusInputOnScreenFocus/index.ts +++ b/src/libs/canFocusInputOnScreenFocus/index.ts @@ -1,5 +1,5 @@ import * as DeviceCapabilities from '@libs/DeviceCapabilities'; -import CanFocusInputOnScreenFocus from './types'; +import type CanFocusInputOnScreenFocus from './types'; const canFocusInputOnScreenFocus: CanFocusInputOnScreenFocus = () => !DeviceCapabilities.canUseTouchScreen(); diff --git a/src/libs/convertToLTR/index.android.ts b/src/libs/convertToLTR/index.android.ts index d73fd3de7a21..07f761752307 100644 --- a/src/libs/convertToLTR/index.android.ts +++ b/src/libs/convertToLTR/index.android.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import ConvertToLTR from './types'; +import type ConvertToLTR from './types'; /** * Android only - convert RTL text to a LTR text using Unicode controls. diff --git a/src/libs/convertToLTR/index.ts b/src/libs/convertToLTR/index.ts index 58d8be93836e..5c2df7c39c2c 100644 --- a/src/libs/convertToLTR/index.ts +++ b/src/libs/convertToLTR/index.ts @@ -1,4 +1,4 @@ -import ConvertToLTR from './types'; +import type ConvertToLTR from './types'; const convertToLTR: ConvertToLTR = (text) => text; diff --git a/src/libs/convertToLTRForComposer/index.android.ts b/src/libs/convertToLTRForComposer/index.android.ts index 09e7f2e5cd87..cf288142f464 100644 --- a/src/libs/convertToLTRForComposer/index.android.ts +++ b/src/libs/convertToLTRForComposer/index.android.ts @@ -1,4 +1,4 @@ -import ConvertToLTRForComposer from './types'; +import type ConvertToLTRForComposer from './types'; /** * Android only - Do not convert RTL text to a LTR text for input box using Unicode controls. diff --git a/src/libs/convertToLTRForComposer/index.ts b/src/libs/convertToLTRForComposer/index.ts index dd6ee50d862e..804f5a4cd7e5 100644 --- a/src/libs/convertToLTRForComposer/index.ts +++ b/src/libs/convertToLTRForComposer/index.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import ConvertToLTRForComposer from './types'; +import type ConvertToLTRForComposer from './types'; function hasRTLCharacters(text: string): boolean { // Regular expressions to match RTL character ranges. diff --git a/src/libs/cropOrRotateImage/index.native.ts b/src/libs/cropOrRotateImage/index.native.ts index 08a5ecb04f6b..c3fed59ba4fa 100644 --- a/src/libs/cropOrRotateImage/index.native.ts +++ b/src/libs/cropOrRotateImage/index.native.ts @@ -1,6 +1,6 @@ import RNImageManipulator from '@oguzhnatly/react-native-image-manipulator'; import RNFetchBlob from 'react-native-blob-util'; -import {CropOrRotateImage} from './types'; +import type {CropOrRotateImage} from './types'; /** * Crops and rotates the image on ios/android diff --git a/src/libs/cropOrRotateImage/index.ts b/src/libs/cropOrRotateImage/index.ts index a66ddbb40b00..ea3d51a465ec 100644 --- a/src/libs/cropOrRotateImage/index.ts +++ b/src/libs/cropOrRotateImage/index.ts @@ -1,4 +1,4 @@ -import {CropOptions, CropOrRotateImage, CropOrRotateImageOptions} from './types'; +import type {CropOptions, CropOrRotateImage, CropOrRotateImageOptions} from './types'; type SizeFromAngle = { width: number; diff --git a/src/libs/cropOrRotateImage/types.ts b/src/libs/cropOrRotateImage/types.ts index 188d557a1258..f882e4f9bea2 100644 --- a/src/libs/cropOrRotateImage/types.ts +++ b/src/libs/cropOrRotateImage/types.ts @@ -1,4 +1,4 @@ -import {RNImageManipulatorResult} from '@oguzhnatly/react-native-image-manipulator'; +import type {RNImageManipulatorResult} from '@oguzhnatly/react-native-image-manipulator'; type CropOrRotateImageOptions = { type: string; diff --git a/src/libs/fileDownload/getImageResolution.native.ts b/src/libs/fileDownload/getImageResolution.native.ts index 3bdff78a93ed..645148ef5194 100644 --- a/src/libs/fileDownload/getImageResolution.native.ts +++ b/src/libs/fileDownload/getImageResolution.native.ts @@ -1,4 +1,4 @@ -import {Asset} from 'react-native-image-picker'; +import type {Asset} from 'react-native-image-picker'; import type {GetImageResolution} from './types'; /** diff --git a/src/libs/fileDownload/index.android.ts b/src/libs/fileDownload/index.android.ts index 8496c1cb6cf5..577a42dd14a3 100644 --- a/src/libs/fileDownload/index.android.ts +++ b/src/libs/fileDownload/index.android.ts @@ -1,5 +1,6 @@ import {PermissionsAndroid, Platform} from 'react-native'; -import RNFetchBlob, {FetchBlobResponse} from 'react-native-blob-util'; +import type {FetchBlobResponse} from 'react-native-blob-util'; +import RNFetchBlob from 'react-native-blob-util'; import * as FileUtils from './FileUtils'; import type {FileDownload} from './types'; diff --git a/src/libs/fileDownload/types.ts b/src/libs/fileDownload/types.ts index c7388f2e52a2..bc8ba0807eb1 100644 --- a/src/libs/fileDownload/types.ts +++ b/src/libs/fileDownload/types.ts @@ -1,4 +1,4 @@ -import {Asset} from 'react-native-image-picker'; +import type {Asset} from 'react-native-image-picker'; type FileDownload = (url: string, fileName: string) => Promise; diff --git a/src/libs/focusAndUpdateMultilineInputRange.ts b/src/libs/focusAndUpdateMultilineInputRange.ts index 92da790e383f..2e4a3d23631e 100644 --- a/src/libs/focusAndUpdateMultilineInputRange.ts +++ b/src/libs/focusAndUpdateMultilineInputRange.ts @@ -1,4 +1,4 @@ -import {TextInput} from 'react-native'; +import type {TextInput} from 'react-native'; /** * Focus a multiline text input and place the cursor at the end of the value (if there is a value in the input). diff --git a/src/libs/focusComposerWithDelay.ts b/src/libs/focusComposerWithDelay.ts index 19f1050d24bd..6a2f85f7d311 100644 --- a/src/libs/focusComposerWithDelay.ts +++ b/src/libs/focusComposerWithDelay.ts @@ -1,4 +1,4 @@ -import {TextInput} from 'react-native'; +import type {TextInput} from 'react-native'; import * as EmojiPickerAction from './actions/EmojiPickerAction'; import ComposerFocusManager from './ComposerFocusManager'; diff --git a/src/libs/focusTextInputAfterAnimation/index.android.ts b/src/libs/focusTextInputAfterAnimation/index.android.ts index 5de1f1f4696b..31c748f5daa4 100644 --- a/src/libs/focusTextInputAfterAnimation/index.android.ts +++ b/src/libs/focusTextInputAfterAnimation/index.android.ts @@ -1,4 +1,4 @@ -import FocusTextInputAfterAnimation from './types'; +import type FocusTextInputAfterAnimation from './types'; /** * Initially this file is intended for native ios but use index.native.js filename and affects android. diff --git a/src/libs/focusTextInputAfterAnimation/index.ts b/src/libs/focusTextInputAfterAnimation/index.ts index 1e3211372b41..3f7c6555b5ce 100644 --- a/src/libs/focusTextInputAfterAnimation/index.ts +++ b/src/libs/focusTextInputAfterAnimation/index.ts @@ -1,4 +1,4 @@ -import FocusTextInputAfterAnimation from './types'; +import type FocusTextInputAfterAnimation from './types'; /** * This library is a no-op for all platforms except for Android and iOS and will immediately focus the given input without any delays. diff --git a/src/libs/focusTextInputAfterAnimation/types.ts b/src/libs/focusTextInputAfterAnimation/types.ts index 905ac7db4b7a..a6a14165598b 100644 --- a/src/libs/focusTextInputAfterAnimation/types.ts +++ b/src/libs/focusTextInputAfterAnimation/types.ts @@ -1,4 +1,4 @@ -import {TextInput} from 'react-native'; +import type {TextInput} from 'react-native'; type FocusTextInputAfterAnimation = (inputRef: TextInput | HTMLInputElement, animationLength: number) => void; diff --git a/src/libs/getButtonState.ts b/src/libs/getButtonState.ts index fe593b9f613e..fc0609ace1f6 100644 --- a/src/libs/getButtonState.ts +++ b/src/libs/getButtonState.ts @@ -1,4 +1,4 @@ -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; /** diff --git a/src/libs/getClickedTargetLocation/index.native.ts b/src/libs/getClickedTargetLocation/index.native.ts index 1755d4e4ac99..a07dd9a8d0da 100644 --- a/src/libs/getClickedTargetLocation/index.native.ts +++ b/src/libs/getClickedTargetLocation/index.native.ts @@ -1,4 +1,4 @@ -import GetClickedTargetLocation from './types'; +import type GetClickedTargetLocation from './types'; /** * We don't need to get the position of the element on native platforms because the popover will be bottom mounted diff --git a/src/libs/getClickedTargetLocation/index.ts b/src/libs/getClickedTargetLocation/index.ts index e218700c3355..f7d12995a2bf 100644 --- a/src/libs/getClickedTargetLocation/index.ts +++ b/src/libs/getClickedTargetLocation/index.ts @@ -1,4 +1,4 @@ -import GetClickedTargetLocation from './types'; +import type GetClickedTargetLocation from './types'; /** * Returns the Bounding Rectangle for the passed native event's target. diff --git a/src/libs/getComponentDisplayName.ts b/src/libs/getComponentDisplayName.ts index 0bf52d543a84..da5eef5212e0 100644 --- a/src/libs/getComponentDisplayName.ts +++ b/src/libs/getComponentDisplayName.ts @@ -1,4 +1,4 @@ -import {ComponentType} from 'react'; +import type {ComponentType} from 'react'; /** Returns the display name of a component */ export default function getComponentDisplayName(component: ComponentType): string { diff --git a/src/libs/getCurrentPosition/index.android.ts b/src/libs/getCurrentPosition/index.android.ts index b29483a5c672..bd27944b8830 100644 --- a/src/libs/getCurrentPosition/index.android.ts +++ b/src/libs/getCurrentPosition/index.android.ts @@ -2,7 +2,8 @@ // If we update our react native version, we need to test this file again import Geolocation from '@react-native-community/geolocation'; import RNAndroidLocationEnabler from 'react-native-android-location-enabler'; -import {GeolocationErrorCode, GetCurrentPosition} from './getCurrentPosition.types'; +import type {GetCurrentPosition} from './getCurrentPosition.types'; +import {GeolocationErrorCode} from './getCurrentPosition.types'; Geolocation.setRNConfiguration({ skipPermissionRequests: false, diff --git a/src/libs/getCurrentPosition/index.ios.ts b/src/libs/getCurrentPosition/index.ios.ts index fb513c4afd16..e64abb0d4329 100644 --- a/src/libs/getCurrentPosition/index.ios.ts +++ b/src/libs/getCurrentPosition/index.ios.ts @@ -1,5 +1,5 @@ import Geolocation from '@react-native-community/geolocation'; -import {GetCurrentPosition} from './getCurrentPosition.types'; +import type {GetCurrentPosition} from './getCurrentPosition.types'; Geolocation.setRNConfiguration({ skipPermissionRequests: false, diff --git a/src/libs/getCurrentPosition/index.ts b/src/libs/getCurrentPosition/index.ts index 11112b0682f8..318d4f64ed34 100644 --- a/src/libs/getCurrentPosition/index.ts +++ b/src/libs/getCurrentPosition/index.ts @@ -1,4 +1,5 @@ -import {GeolocationErrorCode, GetCurrentPosition} from './getCurrentPosition.types'; +import type {GetCurrentPosition} from './getCurrentPosition.types'; +import {GeolocationErrorCode} from './getCurrentPosition.types'; const getCurrentPosition: GetCurrentPosition = (success, error, options) => { if (navigator === undefined || !('geolocation' in navigator)) { diff --git a/src/libs/getModalState.ts b/src/libs/getModalState.ts index 47aa0c406b29..8906718d9168 100644 --- a/src/libs/getModalState.ts +++ b/src/libs/getModalState.ts @@ -1,6 +1,7 @@ -import Onyx, {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; -import Modal from '@src/types/onyx/Modal'; +import type Modal from '@src/types/onyx/Modal'; let modalState: OnyxEntry = {}; diff --git a/src/libs/getOperatingSystem/index.native.ts b/src/libs/getOperatingSystem/index.native.ts index f3e856cb14c9..67f27dcfec28 100644 --- a/src/libs/getOperatingSystem/index.native.ts +++ b/src/libs/getOperatingSystem/index.native.ts @@ -1,6 +1,6 @@ import {Platform} from 'react-native'; import CONST from '@src/CONST'; -import GetOperatingSystem from './types'; +import type GetOperatingSystem from './types'; /** * Reads the current operating system for native platforms. diff --git a/src/libs/getOperatingSystem/index.ts b/src/libs/getOperatingSystem/index.ts index 630595d97471..7e59a1f88b98 100644 --- a/src/libs/getOperatingSystem/index.ts +++ b/src/libs/getOperatingSystem/index.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import GetOperatingSystem from './types'; +import type GetOperatingSystem from './types'; /** * Reads the current operating system when running on Web/Mobile-Web/Desktop diff --git a/src/libs/getOperatingSystem/types.ts b/src/libs/getOperatingSystem/types.ts index a4b3046b4cd9..055ba488f760 100644 --- a/src/libs/getOperatingSystem/types.ts +++ b/src/libs/getOperatingSystem/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; type OS = ValueOf | null; type GetOperatingSystem = () => OS; diff --git a/src/libs/getPermittedDecimalSeparator/index.ios.ts b/src/libs/getPermittedDecimalSeparator/index.ios.ts index f7c2d1eeaa9f..6ccbf48a5622 100644 --- a/src/libs/getPermittedDecimalSeparator/index.ios.ts +++ b/src/libs/getPermittedDecimalSeparator/index.ios.ts @@ -1,6 +1,6 @@ // On iOS keyboard can only have one symbol at a time (either dot or comma) so we accept both // Details: https://expensify.slack.com/archives/C01GTK53T8Q/p1658936908481629 -import GetPermittedDecimalSeparator from './types'; +import type GetPermittedDecimalSeparator from './types'; const getPermittedDecimalSeparator: GetPermittedDecimalSeparator = () => '.,'; diff --git a/src/libs/getPermittedDecimalSeparator/index.ts b/src/libs/getPermittedDecimalSeparator/index.ts index 120e9e046aff..ae9883729259 100644 --- a/src/libs/getPermittedDecimalSeparator/index.ts +++ b/src/libs/getPermittedDecimalSeparator/index.ts @@ -1,7 +1,7 @@ import getOperatingSystem from '@libs/getOperatingSystem'; import CONST from '@src/CONST'; import getPermittedDecimalSeparatorIOS from './index.ios'; -import GetPermittedDecimalSeparator from './types'; +import type GetPermittedDecimalSeparator from './types'; const getPermittedDecimalSeparator: GetPermittedDecimalSeparator = (localizedSeparator) => { if (getOperatingSystem() === CONST.OS.IOS) { diff --git a/src/libs/getPlaidDesktopMessage/index.desktop.ts b/src/libs/getPlaidDesktopMessage/index.desktop.ts index 93a336af8227..b43d6630d81b 100644 --- a/src/libs/getPlaidDesktopMessage/index.desktop.ts +++ b/src/libs/getPlaidDesktopMessage/index.desktop.ts @@ -1,4 +1,4 @@ -import GetPlaidDesktopMessage from './types'; +import type GetPlaidDesktopMessage from './types'; const getPlaidDesktopMessage: GetPlaidDesktopMessage = () => 'bankAccount.desktopConnection'; diff --git a/src/libs/getPlaidDesktopMessage/index.ts b/src/libs/getPlaidDesktopMessage/index.ts index deccb4df0ac2..ba40c7819222 100644 --- a/src/libs/getPlaidDesktopMessage/index.ts +++ b/src/libs/getPlaidDesktopMessage/index.ts @@ -1,4 +1,4 @@ -import GetPlaidDesktopMessage from './types'; +import type GetPlaidDesktopMessage from './types'; const getPlaidDesktopMessage: GetPlaidDesktopMessage = () => undefined; diff --git a/src/libs/getPlaidLinkTokenParameters/index.android.ts b/src/libs/getPlaidLinkTokenParameters/index.android.ts index c7e2aa8efd1e..f5caa28906c2 100644 --- a/src/libs/getPlaidLinkTokenParameters/index.android.ts +++ b/src/libs/getPlaidLinkTokenParameters/index.android.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import GetPlaidLinkTokenParameters from './types'; +import type GetPlaidLinkTokenParameters from './types'; const getPlaidLinkTokenParameters: GetPlaidLinkTokenParameters = () => ({ androidPackage: CONST.ANDROID_PACKAGE_NAME, diff --git a/src/libs/getPlaidLinkTokenParameters/index.ios.ts b/src/libs/getPlaidLinkTokenParameters/index.ios.ts index 8c69ddc71bb2..b15b7e92813a 100644 --- a/src/libs/getPlaidLinkTokenParameters/index.ios.ts +++ b/src/libs/getPlaidLinkTokenParameters/index.ios.ts @@ -1,5 +1,5 @@ import CONFIG from '@src/CONFIG'; -import GetPlaidLinkTokenParameters from './types'; +import type GetPlaidLinkTokenParameters from './types'; const getPlaidLinkTokenParameters: GetPlaidLinkTokenParameters = () => ({ redirectURI: `${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}partners/plaid/oauth_ios`, diff --git a/src/libs/getPlaidLinkTokenParameters/index.ts b/src/libs/getPlaidLinkTokenParameters/index.ts index 570951e3d683..9218c7d37002 100644 --- a/src/libs/getPlaidLinkTokenParameters/index.ts +++ b/src/libs/getPlaidLinkTokenParameters/index.ts @@ -1,6 +1,6 @@ import CONFIG from '@src/CONFIG'; import ROUTES from '@src/ROUTES'; -import GetPlaidLinkTokenParameters from './types'; +import type GetPlaidLinkTokenParameters from './types'; const getPlaidLinkTokenParameters: GetPlaidLinkTokenParameters = () => { const bankAccountRoute = window.location.href.includes('personal') ? ROUTES.BANK_ACCOUNT_PERSONAL : ROUTES.BANK_ACCOUNT; diff --git a/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts b/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts index c435d1799cb8..49660dd6f077 100644 --- a/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts +++ b/src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts @@ -1,4 +1,4 @@ -import GetPlaidOAuthReceivedRedirectURI from './types'; +import type GetPlaidOAuthReceivedRedirectURI from './types'; const getPlaidOAuthReceivedRedirectURI: GetPlaidOAuthReceivedRedirectURI = () => null; diff --git a/src/libs/getPlaidOAuthReceivedRedirectURI/index.ts b/src/libs/getPlaidOAuthReceivedRedirectURI/index.ts index 8492a2d9c91e..c140d1c3339f 100644 --- a/src/libs/getPlaidOAuthReceivedRedirectURI/index.ts +++ b/src/libs/getPlaidOAuthReceivedRedirectURI/index.ts @@ -1,4 +1,4 @@ -import GetPlaidOAuthReceivedRedirectURI from './types'; +import type GetPlaidOAuthReceivedRedirectURI from './types'; /** * After a user authenticates their bank in the Plaid OAuth flow, Plaid returns us to the redirectURI we diff --git a/src/libs/getPlatform/index.android.ts b/src/libs/getPlatform/index.android.ts index a0f4edb055af..a704f18ad11b 100644 --- a/src/libs/getPlatform/index.android.ts +++ b/src/libs/getPlatform/index.android.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import Platform from './types'; +import type Platform from './types'; export default function getPlatform(): Platform { return CONST.PLATFORM.ANDROID; diff --git a/src/libs/getPlatform/index.desktop.ts b/src/libs/getPlatform/index.desktop.ts index 0b90b5f121bb..4bf042159758 100644 --- a/src/libs/getPlatform/index.desktop.ts +++ b/src/libs/getPlatform/index.desktop.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import Platform from './types'; +import type Platform from './types'; export default function getPlatform(): Platform { return CONST.PLATFORM.DESKTOP; diff --git a/src/libs/getPlatform/index.ios.ts b/src/libs/getPlatform/index.ios.ts index ee35c8b610bc..9b7155b50cad 100644 --- a/src/libs/getPlatform/index.ios.ts +++ b/src/libs/getPlatform/index.ios.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import Platform from './types'; +import type Platform from './types'; export default function getPlatform(): Platform { return CONST.PLATFORM.IOS; diff --git a/src/libs/getPlatform/index.ts b/src/libs/getPlatform/index.ts index ca87e79170f5..5f5b45ac6e7d 100644 --- a/src/libs/getPlatform/index.ts +++ b/src/libs/getPlatform/index.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import Platform from './types'; +import type Platform from './types'; export default function getPlatform(): Platform { return CONST.PLATFORM.WEB; diff --git a/src/libs/getPlatform/types.ts b/src/libs/getPlatform/types.ts index 9c43c696a6f8..1ffc18f311de 100644 --- a/src/libs/getPlatform/types.ts +++ b/src/libs/getPlatform/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; type Platform = ValueOf; diff --git a/src/libs/getSecureEntryKeyboardType/index.android.ts b/src/libs/getSecureEntryKeyboardType/index.android.ts index bc50e202381b..6cded09f1d49 100644 --- a/src/libs/getSecureEntryKeyboardType/index.android.ts +++ b/src/libs/getSecureEntryKeyboardType/index.android.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import GetSecureEntryKeyboardType from './types'; +import type GetSecureEntryKeyboardType from './types'; /** * Return visible-password keyboard type when secure text is visible on Android, diff --git a/src/libs/getSecureEntryKeyboardType/index.ts b/src/libs/getSecureEntryKeyboardType/index.ts index 030a88e60e84..1b8f5d9f20ba 100644 --- a/src/libs/getSecureEntryKeyboardType/index.ts +++ b/src/libs/getSecureEntryKeyboardType/index.ts @@ -1,4 +1,4 @@ -import GetSecureEntryKeyboardType from './types'; +import type GetSecureEntryKeyboardType from './types'; /** * Return keyboardType passed as function parameter on Web/Desktop/iOS diff --git a/src/libs/getSecureEntryKeyboardType/types.ts b/src/libs/getSecureEntryKeyboardType/types.ts index 750c84133ea2..3664d27cadec 100644 --- a/src/libs/getSecureEntryKeyboardType/types.ts +++ b/src/libs/getSecureEntryKeyboardType/types.ts @@ -1,4 +1,4 @@ -import {KeyboardTypeOptions} from 'react-native'; +import type {KeyboardTypeOptions} from 'react-native'; type GetSecureEntryKeyboardType = (keyboardType: KeyboardTypeOptions | undefined, secureTextEntry: boolean, passwordHidden: boolean) => KeyboardTypeOptions | undefined; diff --git a/src/libs/getWindowHeightAdjustment/index.android.ts b/src/libs/getWindowHeightAdjustment/index.android.ts index 1a06e663d4e3..6117e7ed4a8e 100644 --- a/src/libs/getWindowHeightAdjustment/index.android.ts +++ b/src/libs/getWindowHeightAdjustment/index.android.ts @@ -1,4 +1,4 @@ -import GetWindowHeightAdjustment from './types'; +import type GetWindowHeightAdjustment from './types'; // On Android the window height does not include the status bar height, so we need to add it manually. const getWindowHeightAdjustment: GetWindowHeightAdjustment = (insets) => insets?.top ?? 0; diff --git a/src/libs/getWindowHeightAdjustment/index.ts b/src/libs/getWindowHeightAdjustment/index.ts index 9a768d00cd4d..c8ca7f8b48df 100644 --- a/src/libs/getWindowHeightAdjustment/index.ts +++ b/src/libs/getWindowHeightAdjustment/index.ts @@ -1,4 +1,4 @@ -import GetWindowHeightAdjustment from './types'; +import type GetWindowHeightAdjustment from './types'; // Some platforms need to adjust the window height. const getWindowHeightAdjustment: GetWindowHeightAdjustment = () => 0; diff --git a/src/libs/getWindowHeightAdjustment/types.ts b/src/libs/getWindowHeightAdjustment/types.ts index ddb6723f6320..07d5c74bff27 100644 --- a/src/libs/getWindowHeightAdjustment/types.ts +++ b/src/libs/getWindowHeightAdjustment/types.ts @@ -1,4 +1,4 @@ -import {EdgeInsets} from 'react-native-safe-area-context'; +import type {EdgeInsets} from 'react-native-safe-area-context'; type GetWindowHeightAdjustment = (insets: EdgeInsets | null) => number; diff --git a/src/libs/isInputAutoFilled.ts b/src/libs/isInputAutoFilled.ts index fbe6240def47..a6dda57f41ec 100644 --- a/src/libs/isInputAutoFilled.ts +++ b/src/libs/isInputAutoFilled.ts @@ -1,4 +1,4 @@ -import {TextInput} from 'react-native'; +import type {TextInput} from 'react-native'; import isSelectorSupported from './isSelectorSupported'; /** diff --git a/src/libs/isReportMessageAttachment.ts b/src/libs/isReportMessageAttachment.ts index 097f46465dc9..df8a589f7bdc 100644 --- a/src/libs/isReportMessageAttachment.ts +++ b/src/libs/isReportMessageAttachment.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import {Message} from '@src/types/onyx/ReportAction'; +import type {Message} from '@src/types/onyx/ReportAction'; /** * Check whether a report action is Attachment or not. diff --git a/src/libs/isSelectorSupported/index.native.ts b/src/libs/isSelectorSupported/index.native.ts index fa846e1410d9..bd14cf3f5d07 100644 --- a/src/libs/isSelectorSupported/index.native.ts +++ b/src/libs/isSelectorSupported/index.native.ts @@ -1,4 +1,4 @@ -import IsSelectorSupported from './types'; +import type IsSelectorSupported from './types'; // Native platforms do not support the selector const isSelectorSupported: IsSelectorSupported = () => false; diff --git a/src/libs/isSelectorSupported/index.ts b/src/libs/isSelectorSupported/index.ts index 4f5f0313243e..7ed05fdc944e 100644 --- a/src/libs/isSelectorSupported/index.ts +++ b/src/libs/isSelectorSupported/index.ts @@ -1,4 +1,4 @@ -import IsSelectorSupported from './types'; +import type IsSelectorSupported from './types'; /** * Check platform supports the selector or not diff --git a/src/libs/localFileDownload/index.android.ts b/src/libs/localFileDownload/index.android.ts index 4de6cbd0e940..b6d8ea13738f 100644 --- a/src/libs/localFileDownload/index.android.ts +++ b/src/libs/localFileDownload/index.android.ts @@ -1,6 +1,6 @@ import RNFetchBlob from 'react-native-blob-util'; import * as FileUtils from '@libs/fileDownload/FileUtils'; -import LocalFileDownload from './types'; +import type LocalFileDownload from './types'; /** * Writes a local file to the app's internal directory with the given fileName diff --git a/src/libs/localFileDownload/index.ios.ts b/src/libs/localFileDownload/index.ios.ts index 5461c6ffc4c4..892ab29d21f5 100644 --- a/src/libs/localFileDownload/index.ios.ts +++ b/src/libs/localFileDownload/index.ios.ts @@ -1,7 +1,7 @@ import {Share} from 'react-native'; import RNFetchBlob from 'react-native-blob-util'; import * as FileUtils from '@libs/fileDownload/FileUtils'; -import LocalFileDownload from './types'; +import type LocalFileDownload from './types'; /** * Writes a local file to the app's internal directory with the given fileName diff --git a/src/libs/localFileDownload/index.ts b/src/libs/localFileDownload/index.ts index 2a70a01f88c0..ba038b8853ad 100644 --- a/src/libs/localFileDownload/index.ts +++ b/src/libs/localFileDownload/index.ts @@ -1,5 +1,5 @@ import * as FileUtils from '@libs/fileDownload/FileUtils'; -import LocalFileDownload from './types'; +import type LocalFileDownload from './types'; /** * Creates a Blob with the given fileName and textContent, then dynamically diff --git a/src/libs/migrations/CheckForPreviousReportActionID.ts b/src/libs/migrations/CheckForPreviousReportActionID.ts index 1f31a3586b0a..d97bd87f0a2a 100644 --- a/src/libs/migrations/CheckForPreviousReportActionID.ts +++ b/src/libs/migrations/CheckForPreviousReportActionID.ts @@ -1,7 +1,8 @@ -import Onyx, {OnyxCollection} from 'react-native-onyx'; +import type {OnyxCollection} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import Log from '@libs/Log'; import ONYXKEYS from '@src/ONYXKEYS'; -import * as OnyxTypes from '@src/types/onyx'; +import type * as OnyxTypes from '@src/types/onyx'; function getReportActionsFromOnyx(): Promise> { return new Promise((resolve) => { diff --git a/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts b/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts index 1abe5a6114bb..dbf2829a6c28 100644 --- a/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts +++ b/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts @@ -1,7 +1,8 @@ -import Onyx, {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import Log from '@libs/Log'; import ONYXKEYS from '@src/ONYXKEYS'; -import {ReportActionsDrafts} from '@src/types/onyx'; +import type {ReportActionsDrafts} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; type ReportActionsDraftsKey = `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`; diff --git a/src/libs/migrations/RemoveEmptyReportActionsDrafts.ts b/src/libs/migrations/RemoveEmptyReportActionsDrafts.ts index d8816198e537..48493a82d641 100644 --- a/src/libs/migrations/RemoveEmptyReportActionsDrafts.ts +++ b/src/libs/migrations/RemoveEmptyReportActionsDrafts.ts @@ -1,8 +1,9 @@ import _ from 'lodash'; -import Onyx, {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import Log from '@libs/Log'; import ONYXKEYS from '@src/ONYXKEYS'; -import {ReportActionsDraft, ReportActionsDrafts} from '@src/types/onyx'; +import type {ReportActionsDraft, ReportActionsDrafts} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; type ReportActionsDraftsKey = `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`; diff --git a/src/libs/migrations/RenameReceiptFilename.ts b/src/libs/migrations/RenameReceiptFilename.ts index b2c19848aedb..dff2be5c286d 100644 --- a/src/libs/migrations/RenameReceiptFilename.ts +++ b/src/libs/migrations/RenameReceiptFilename.ts @@ -1,8 +1,8 @@ import Onyx from 'react-native-onyx'; -import {NullishDeep, OnyxCollection} from 'react-native-onyx/lib/types'; +import type {NullishDeep, OnyxCollection} from 'react-native-onyx/lib/types'; import Log from '@libs/Log'; import ONYXKEYS from '@src/ONYXKEYS'; -import Transaction from '@src/types/onyx/Transaction'; +import type Transaction from '@src/types/onyx/Transaction'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; type OldTransaction = Transaction & {receiptFilename?: string}; diff --git a/src/libs/migrations/TransactionBackupsToCollection.ts b/src/libs/migrations/TransactionBackupsToCollection.ts index ddaa691b8d47..407bc70e1f38 100644 --- a/src/libs/migrations/TransactionBackupsToCollection.ts +++ b/src/libs/migrations/TransactionBackupsToCollection.ts @@ -1,7 +1,8 @@ -import Onyx, {OnyxCollection} from 'react-native-onyx'; +import type {OnyxCollection} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import Log from '@libs/Log'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Transaction} from '@src/types/onyx'; +import type {Transaction} from '@src/types/onyx'; /** * This migration moves all the transaction backups stored in the transaction collection, ONYXKEYS.COLLECTION.TRANSACTION, to a reserved collection that only diff --git a/src/libs/models/BankAccount.ts b/src/libs/models/BankAccount.ts index 6fd77b161aa9..611d77c99927 100644 --- a/src/libs/models/BankAccount.ts +++ b/src/libs/models/BankAccount.ts @@ -1,7 +1,8 @@ import Str from 'expensify-common/lib/str'; -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; -import BankAccountJSON, {AdditionalData} from '@src/types/onyx/BankAccount'; +import type {AdditionalData} from '@src/types/onyx/BankAccount'; +import type BankAccountJSON from '@src/types/onyx/BankAccount'; type State = ValueOf; diff --git a/src/libs/onyxSubscribe.ts b/src/libs/onyxSubscribe.ts index 5e3213cdcf95..4572ca35a4f2 100644 --- a/src/libs/onyxSubscribe.ts +++ b/src/libs/onyxSubscribe.ts @@ -1,5 +1,6 @@ -import Onyx, {ConnectOptions} from 'react-native-onyx'; -import {OnyxKey} from '@src/ONYXKEYS'; +import type {ConnectOptions} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {OnyxKey} from '@src/ONYXKEYS'; /** * Connect to onyx data. Same params as Onyx.connect(), but returns a function to unsubscribe. diff --git a/src/libs/setSelection/index.native.ts b/src/libs/setSelection/index.native.ts index e27cd4e58bd7..5bac8be9ae65 100644 --- a/src/libs/setSelection/index.native.ts +++ b/src/libs/setSelection/index.native.ts @@ -1,4 +1,4 @@ -import SetSelection from './types'; +import type SetSelection from './types'; const setSelection: SetSelection = (textInput, start, end) => { if (!textInput) { diff --git a/src/libs/setSelection/index.ts b/src/libs/setSelection/index.ts index 5eee88881924..f518ba4480e8 100644 --- a/src/libs/setSelection/index.ts +++ b/src/libs/setSelection/index.ts @@ -1,4 +1,4 @@ -import SetSelection from './types'; +import type SetSelection from './types'; const setSelection: SetSelection = (textInput, start, end) => { if (!textInput) { diff --git a/src/libs/setSelection/types.ts b/src/libs/setSelection/types.ts index f2717079725f..9e9647c4abe1 100644 --- a/src/libs/setSelection/types.ts +++ b/src/libs/setSelection/types.ts @@ -1,4 +1,4 @@ -import {TextInput} from 'react-native'; +import type {TextInput} from 'react-native'; type SetSelection = (textInput: TextInput | HTMLInputElement, start: number, end: number) => void; diff --git a/src/libs/setShouldShowComposeInputKeyboardAware/index.ts b/src/libs/setShouldShowComposeInputKeyboardAware/index.ts index a6217fcd761b..999df8c16bf1 100644 --- a/src/libs/setShouldShowComposeInputKeyboardAware/index.ts +++ b/src/libs/setShouldShowComposeInputKeyboardAware/index.ts @@ -1,5 +1,5 @@ import * as Composer from '@userActions/Composer'; -import SetShouldShowComposeInputKeyboardAware from './types'; +import type SetShouldShowComposeInputKeyboardAware from './types'; const setShouldShowComposeInputKeyboardAware: SetShouldShowComposeInputKeyboardAware = (shouldShow) => { Composer.setShouldShowComposeInput(shouldShow); diff --git a/src/libs/setShouldShowComposeInputKeyboardAware/setShouldShowComposeInputKeyboardAwareBuilder.ts b/src/libs/setShouldShowComposeInputKeyboardAware/setShouldShowComposeInputKeyboardAwareBuilder.ts index 528b71c45ab8..8d5ef578b66c 100644 --- a/src/libs/setShouldShowComposeInputKeyboardAware/setShouldShowComposeInputKeyboardAwareBuilder.ts +++ b/src/libs/setShouldShowComposeInputKeyboardAware/setShouldShowComposeInputKeyboardAwareBuilder.ts @@ -1,7 +1,8 @@ -import {EmitterSubscription, Keyboard} from 'react-native'; -import {KeyboardEventName} from 'react-native/Libraries/Components/Keyboard/Keyboard'; +import type {EmitterSubscription} from 'react-native'; +import {Keyboard} from 'react-native'; +import type {KeyboardEventName} from 'react-native/Libraries/Components/Keyboard/Keyboard'; import * as Composer from '@userActions/Composer'; -import SetShouldShowComposeInputKeyboardAware from './types'; +import type SetShouldShowComposeInputKeyboardAware from './types'; let keyboardEventListener: EmitterSubscription | null = null; // On iOS, there is a visible delay in displaying input after the keyboard has been closed with the `keyboardDidHide` event diff --git a/src/libs/shouldDelayFocus/index.android.ts b/src/libs/shouldDelayFocus/index.android.ts index 566628c4df9d..cffa262b5a92 100644 --- a/src/libs/shouldDelayFocus/index.android.ts +++ b/src/libs/shouldDelayFocus/index.android.ts @@ -1,4 +1,4 @@ -import ShouldDelayFocus from './types'; +import type ShouldDelayFocus from './types'; /** When using transitions on Android, we need to delay focusing the text inputs for the keyboard to open. */ const shouldDelayFocus: ShouldDelayFocus = true; diff --git a/src/libs/shouldDelayFocus/index.ts b/src/libs/shouldDelayFocus/index.ts index 0ef7f9b2ccbe..5506eb8a91d2 100644 --- a/src/libs/shouldDelayFocus/index.ts +++ b/src/libs/shouldDelayFocus/index.ts @@ -1,4 +1,4 @@ -import ShouldDelayFocus from './types'; +import type ShouldDelayFocus from './types'; const shouldDelayFocus: ShouldDelayFocus = false; diff --git a/src/libs/shouldRenderOffscreen/index.android.ts b/src/libs/shouldRenderOffscreen/index.android.ts index bf2d9837086f..38cd6ca73ff2 100644 --- a/src/libs/shouldRenderOffscreen/index.android.ts +++ b/src/libs/shouldRenderOffscreen/index.android.ts @@ -1,4 +1,4 @@ -import ShouldRenderOffscreen from './types'; +import type ShouldRenderOffscreen from './types'; // Rendering offscreen on Android allows it to apply opacity to stacked components correctly. const shouldRenderOffscreen: ShouldRenderOffscreen = true; diff --git a/src/libs/shouldRenderOffscreen/index.ts b/src/libs/shouldRenderOffscreen/index.ts index eadcc44814f9..e4a447c38802 100644 --- a/src/libs/shouldRenderOffscreen/index.ts +++ b/src/libs/shouldRenderOffscreen/index.ts @@ -1,4 +1,4 @@ -import ShouldRenderOffscreen from './types'; +import type ShouldRenderOffscreen from './types'; const shouldRenderOffscreen: ShouldRenderOffscreen = false; diff --git a/src/libs/shouldReopenOnfido/index.android.ts b/src/libs/shouldReopenOnfido/index.android.ts index 11f562575b08..6362ce3ded30 100644 --- a/src/libs/shouldReopenOnfido/index.android.ts +++ b/src/libs/shouldReopenOnfido/index.android.ts @@ -1,4 +1,4 @@ -import ShouldReopenOnfido from './types'; +import type ShouldReopenOnfido from './types'; const shouldReopenOnfido: ShouldReopenOnfido = true; diff --git a/src/libs/shouldReopenOnfido/index.ts b/src/libs/shouldReopenOnfido/index.ts index 24322b57df19..8a57c36217ad 100644 --- a/src/libs/shouldReopenOnfido/index.ts +++ b/src/libs/shouldReopenOnfido/index.ts @@ -1,4 +1,4 @@ -import ShouldReopenOnfido from './types'; +import type ShouldReopenOnfido from './types'; const shouldReopenOnfido: ShouldReopenOnfido = false; diff --git a/src/libs/tryResolveUrlFromApiRoot.ts b/src/libs/tryResolveUrlFromApiRoot.ts index 1aa102323a06..7a80228e0a34 100644 --- a/src/libs/tryResolveUrlFromApiRoot.ts +++ b/src/libs/tryResolveUrlFromApiRoot.ts @@ -1,5 +1,5 @@ import Config from '@src/CONFIG'; -import {Request} from '@src/types/onyx'; +import type {Request} from '@src/types/onyx'; import * as ApiUtils from './ApiUtils'; // Absolute URLs (`/` or `//`) should be resolved from API ROOT diff --git a/src/libs/updateMultilineInputRange/index.ios.ts b/src/libs/updateMultilineInputRange/index.ios.ts index cbe271162372..1252079bdaa8 100644 --- a/src/libs/updateMultilineInputRange/index.ios.ts +++ b/src/libs/updateMultilineInputRange/index.ios.ts @@ -1,4 +1,4 @@ -import UpdateMultilineInputRange from './types'; +import type UpdateMultilineInputRange from './types'; /** * Place the cursor at the end of the value (if there is a value in the input). diff --git a/src/libs/updateMultilineInputRange/index.ts b/src/libs/updateMultilineInputRange/index.ts index 062a7a80eeaa..f5d71c5e2038 100644 --- a/src/libs/updateMultilineInputRange/index.ts +++ b/src/libs/updateMultilineInputRange/index.ts @@ -1,5 +1,5 @@ import * as Browser from '@libs/Browser'; -import UpdateMultilineInputRange from './types'; +import type UpdateMultilineInputRange from './types'; /** * Place the cursor at the end of the value (if there is a value in the input). diff --git a/src/libs/updateMultilineInputRange/types.ts b/src/libs/updateMultilineInputRange/types.ts index 95b5a8bce744..d1b134b09a99 100644 --- a/src/libs/updateMultilineInputRange/types.ts +++ b/src/libs/updateMultilineInputRange/types.ts @@ -1,4 +1,4 @@ -import {TextInput} from 'react-native'; +import type {TextInput} from 'react-native'; type UpdateMultilineInputRange = (input: HTMLInputElement | TextInput, shouldAutoFocus?: boolean) => void; diff --git a/src/libs/useNativeDriver/index.native.ts b/src/libs/useNativeDriver/index.native.ts index b7286965f894..93ed069fa807 100644 --- a/src/libs/useNativeDriver/index.native.ts +++ b/src/libs/useNativeDriver/index.native.ts @@ -1,4 +1,4 @@ -import UseNativeDriver from './types'; +import type UseNativeDriver from './types'; const useNativeDriver: UseNativeDriver = true; diff --git a/src/libs/useNativeDriver/index.ts b/src/libs/useNativeDriver/index.ts index 84d34f766e3b..faa9e3597cb9 100644 --- a/src/libs/useNativeDriver/index.ts +++ b/src/libs/useNativeDriver/index.ts @@ -1,4 +1,4 @@ -import UseNativeDriver from './types'; +import type UseNativeDriver from './types'; const useNativeDriver: UseNativeDriver = false; diff --git a/src/libs/willBlurTextInputOnTapOutside/index.native.ts b/src/libs/willBlurTextInputOnTapOutside/index.native.ts index 1cf1bbafe7e6..e411674c4ae5 100644 --- a/src/libs/willBlurTextInputOnTapOutside/index.native.ts +++ b/src/libs/willBlurTextInputOnTapOutside/index.native.ts @@ -1,4 +1,4 @@ -import WillBlurTextInputOnTapOutside from './types'; +import type WillBlurTextInputOnTapOutside from './types'; const willBlurTextInputOnTapOutside: WillBlurTextInputOnTapOutside = () => false; diff --git a/src/libs/willBlurTextInputOnTapOutside/index.ts b/src/libs/willBlurTextInputOnTapOutside/index.ts index 7c88957821b3..987d8a1dfeea 100644 --- a/src/libs/willBlurTextInputOnTapOutside/index.ts +++ b/src/libs/willBlurTextInputOnTapOutside/index.ts @@ -1,4 +1,4 @@ -import WillBlurTextInputOnTapOutside from './types'; +import type WillBlurTextInputOnTapOutside from './types'; const willBlurTextInputOnTapOutside: WillBlurTextInputOnTapOutside = () => true; diff --git a/src/pages/UnlinkLoginPage.tsx b/src/pages/UnlinkLoginPage.tsx index d39f1bce3a47..c8be7a16f3f6 100644 --- a/src/pages/UnlinkLoginPage.tsx +++ b/src/pages/UnlinkLoginPage.tsx @@ -1,14 +1,15 @@ -import {StackScreenProps} from '@react-navigation/stack'; +import type {StackScreenProps} from '@react-navigation/stack'; import React, {useEffect} from 'react'; -import {type OnyxEntry, withOnyx} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import usePrevious from '@hooks/usePrevious'; import Navigation from '@libs/Navigation/Navigation'; -import {PublicScreensParamList} from '@navigation/types'; +import type {PublicScreensParamList} from '@navigation/types'; import * as Session from '@userActions/Session'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import SCREENS from '@src/SCREENS'; +import type SCREENS from '@src/SCREENS'; import type {Account} from '@src/types/onyx'; type UnlinkLoginPageOnyxProps = { diff --git a/src/pages/home/ReportScreenContext.ts b/src/pages/home/ReportScreenContext.ts index 49681d46e4be..98d593b92d91 100644 --- a/src/pages/home/ReportScreenContext.ts +++ b/src/pages/home/ReportScreenContext.ts @@ -1,5 +1,6 @@ -import {createContext, RefObject} from 'react'; -import {FlatList, GestureResponderEvent} from 'react-native'; +import type {RefObject} from 'react'; +import {createContext} from 'react'; +import type {FlatList, GestureResponderEvent} from 'react-native'; type ReactionListRef = { showReactionList: (event: GestureResponderEvent | undefined, reactionListAnchor: Element, emojiName: string, reportActionID: string) => void; diff --git a/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts b/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts index 1e1fc700d8e0..317c3846d160 100644 --- a/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts +++ b/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts @@ -1,8 +1,8 @@ import React from 'react'; -import {GestureResponderEvent, Text as RNText} from 'react-native'; -import {OnyxEntry} from 'react-native-onyx'; -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {GestureResponderEvent, Text as RNText} from 'react-native'; +import type {OnyxEntry} from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; import type {ReportAction} from '@src/types/onyx'; type OnHideCallback = () => void; diff --git a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.android.js b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.android.js new file mode 100644 index 000000000000..f924a7b59194 --- /dev/null +++ b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.android.js @@ -0,0 +1,47 @@ +import PropTypes from 'prop-types'; +import {useEffect} from 'react'; +import {withOnyx} from 'react-native-onyx'; +import ONYXKEYS from '@src/ONYXKEYS'; + +const propTypes = { + /** The comment of the report */ + comment: PropTypes.string, + + /** Updates the comment */ + updateComment: PropTypes.func.isRequired, +}; + +const defaultProps = { + comment: '', +}; + +/** + * Adding .android component to disable updating comment when prev comment is different + * it fixes issue on Android, assuming we don't need tab sync on mobiles - https://github.com/Expensify/App/issues/28562 + */ + +/** + * This component doesn't render anything. It runs a side effect to update the comment of a report under certain conditions. + * It is connected to the actual draft comment in onyx. The comment in onyx might updates multiple times, and we want to avoid + * re-rendering a UI component for that. That's why the side effect was moved down to a separate component. + * @returns {null} + */ +function SilentCommentUpdater({comment, updateComment}) { + useEffect(() => { + updateComment(comment); + // eslint-disable-next-line react-hooks/exhaustive-deps -- We need to run this on mount + }, []); + + return null; +} + +SilentCommentUpdater.propTypes = propTypes; +SilentCommentUpdater.defaultProps = defaultProps; +SilentCommentUpdater.displayName = 'SilentCommentUpdater'; + +export default withOnyx({ + comment: { + key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`, + initialValue: '', + }, +})(SilentCommentUpdater); diff --git a/src/pages/home/report/ReportActionCompose/SilentCommentUpdater.js b/src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.js similarity index 100% rename from src/pages/home/report/ReportActionCompose/SilentCommentUpdater.js rename to src/pages/home/report/ReportActionCompose/SilentCommentUpdater/index.js diff --git a/src/pages/home/report/ReportActionItemBasicMessage.tsx b/src/pages/home/report/ReportActionItemBasicMessage.tsx index 63e6d2424a7c..f0097a6dce26 100644 --- a/src/pages/home/report/ReportActionItemBasicMessage.tsx +++ b/src/pages/home/report/ReportActionItemBasicMessage.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {View} from 'react-native'; import Text from '@components/Text'; import useThemeStyles from '@hooks/useThemeStyles'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type ReportActionItemBasicMessageProps = ChildrenProps & { message: string; diff --git a/src/pages/home/report/ReportActionItemDate.tsx b/src/pages/home/report/ReportActionItemDate.tsx index a8c5c208151a..f7e77023ea64 100644 --- a/src/pages/home/report/ReportActionItemDate.tsx +++ b/src/pages/home/report/ReportActionItemDate.tsx @@ -1,5 +1,5 @@ import React, {memo} from 'react'; -import {OnyxEntry} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; import {withCurrentDate} from '@components/OnyxProvider'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; diff --git a/src/pages/home/report/ReportActionItemDraft.tsx b/src/pages/home/report/ReportActionItemDraft.tsx index de4458d7b39f..aeef024fc630 100644 --- a/src/pages/home/report/ReportActionItemDraft.tsx +++ b/src/pages/home/report/ReportActionItemDraft.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; function ReportActionItemDraft({children}: ChildrenProps) { const styles = useThemeStyles(); diff --git a/src/pages/home/report/ReportActionItemGrouped.tsx b/src/pages/home/report/ReportActionItemGrouped.tsx index 2dff5b81c6a7..f493f7a89334 100644 --- a/src/pages/home/report/ReportActionItemGrouped.tsx +++ b/src/pages/home/report/ReportActionItemGrouped.tsx @@ -1,7 +1,8 @@ import React from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import useThemeStyles from '@hooks/useThemeStyles'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; type ReportActionItemGroupedProps = ChildrenProps & { /** Styles for the outermost View */ diff --git a/src/pages/home/report/ReportActionItemMessage.tsx b/src/pages/home/report/ReportActionItemMessage.tsx index 89d0aaa1523b..d98d1b901578 100644 --- a/src/pages/home/report/ReportActionItemMessage.tsx +++ b/src/pages/home/report/ReportActionItemMessage.tsx @@ -1,5 +1,7 @@ -import React, {ReactElement} from 'react'; -import {StyleProp, Text, View, ViewStyle} from 'react-native'; +import type {ReactElement} from 'react'; +import React from 'react'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {Text, View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index e613dc5ac311..6c4e2b39a329 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -1,5 +1,6 @@ import React, {useCallback, useMemo} from 'react'; -import {StyleProp, View, ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; +import {View} from 'react-native'; import Avatar from '@components/Avatar'; import MultipleAvatars from '@components/MultipleAvatars'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; @@ -21,8 +22,8 @@ import * as UserUtils from '@libs/UserUtils'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type {Report, ReportAction} from '@src/types/onyx'; -import {Icon} from '@src/types/onyx/OnyxCommon'; -import ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {Icon} from '@src/types/onyx/OnyxCommon'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; import ReportActionItemDate from './ReportActionItemDate'; import ReportActionItemFragment from './ReportActionItemFragment'; diff --git a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx index 709f1af1c28d..fb0a00e2d10d 100644 --- a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx +++ b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx @@ -1,10 +1,12 @@ /* eslint-disable rulesdir/no-negated-variables */ -import {RouteProp} from '@react-navigation/native'; -import React, {ComponentType, ForwardedRef, RefAttributes, useCallback, useEffect} from 'react'; -import {OnyxCollection, OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {RouteProp} from '@react-navigation/native'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React, {useCallback, useEffect} from 'react'; +import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import withWindowDimensions from '@components/withWindowDimensions'; -import {WindowDimensionsProps} from '@components/withWindowDimensions/types'; +import type {WindowDimensionsProps} from '@components/withWindowDimensions/types'; import compose from '@libs/compose'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; @@ -12,7 +14,7 @@ import * as ReportUtils from '@libs/ReportUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import * as Report from '@userActions/Report'; import ONYXKEYS from '@src/ONYXKEYS'; -import * as OnyxTypes from '@src/types/onyx'; +import type * as OnyxTypes from '@src/types/onyx'; import {isEmptyObject, isNotEmptyObject} from '@src/types/utils/EmptyObject'; type OnyxProps = { diff --git a/src/pages/home/report/withReportOrNotFound.tsx b/src/pages/home/report/withReportOrNotFound.tsx index cf2c0d5aca4b..7613bafeacdc 100644 --- a/src/pages/home/report/withReportOrNotFound.tsx +++ b/src/pages/home/report/withReportOrNotFound.tsx @@ -1,13 +1,15 @@ /* eslint-disable rulesdir/no-negated-variables */ -import {RouteProp} from '@react-navigation/native'; -import React, {ComponentType, ForwardedRef, RefAttributes} from 'react'; -import {OnyxCollection, OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {RouteProp} from '@react-navigation/native'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React from 'react'; +import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import getComponentDisplayName from '@libs/getComponentDisplayName'; import * as ReportUtils from '@libs/ReportUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import ONYXKEYS from '@src/ONYXKEYS'; -import * as OnyxTypes from '@src/types/onyx'; +import type * as OnyxTypes from '@src/types/onyx'; type OnyxProps = { /** The report currently being looked at */ diff --git a/src/pages/home/sidebar/SidebarLinksData.js b/src/pages/home/sidebar/SidebarLinksData.js index dbc77a41817b..580cc7909fd1 100644 --- a/src/pages/home/sidebar/SidebarLinksData.js +++ b/src/pages/home/sidebar/SidebarLinksData.js @@ -168,6 +168,7 @@ const chatReportSelector = (report) => // Other important less obivous properties for filtering: parentReportActionID: report.parentReportActionID, parentReportID: report.parentReportID, + isDeletedParentAction: report.isDeletedParentAction, }; /** diff --git a/src/pages/iou/WaypointEditor.js b/src/pages/iou/WaypointEditor.js index e8d3c8520ca8..ab8874091152 100644 --- a/src/pages/iou/WaypointEditor.js +++ b/src/pages/iou/WaypointEditor.js @@ -14,6 +14,7 @@ import * as Expensicons from '@components/Icon/Expensicons'; import ScreenWrapper from '@components/ScreenWrapper'; import transactionPropTypes from '@components/transactionPropTypes'; import useLocalize from '@hooks/useLocalize'; +import useLocationBias from '@hooks/useLocationBias'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; @@ -43,6 +44,15 @@ const propTypes = { }), }), + /* Current location coordinates of the user */ + userLocation: PropTypes.shape({ + /** Latitude of the location */ + latitude: PropTypes.number, + + /** Longitude of the location */ + longitude: PropTypes.number, + }), + recentWaypoints: PropTypes.arrayOf( PropTypes.shape({ /** The name of the location */ @@ -74,9 +84,10 @@ const defaultProps = { route: {}, recentWaypoints: [], transaction: {}, + userLocation: undefined, }; -function WaypointEditor({route: {params: {iouType = '', transactionID = '', waypointIndex = '', threadReportID = 0}} = {}, transaction, recentWaypoints}) { +function WaypointEditor({route: {params: {iouType = '', transactionID = '', waypointIndex = '', threadReportID = 0}} = {}, transaction, recentWaypoints, userLocation}) { const styles = useThemeStyles(); const {windowWidth} = useWindowDimensions(); const [isDeleteStopModalOpen, setIsDeleteStopModalOpen] = useState(false); @@ -91,7 +102,7 @@ function WaypointEditor({route: {params: {iouType = '', transactionID = '', wayp const waypointCount = _.size(allWaypoints); const filledWaypointCount = _.size(_.filter(allWaypoints, (waypoint) => !_.isEmpty(waypoint))); - + const locationBias = useLocationBias(allWaypoints, userLocation); const waypointDescriptionKey = useMemo(() => { switch (parsedWaypointIndex) { case 0: @@ -221,6 +232,7 @@ function WaypointEditor({route: {params: {iouType = '', transactionID = '', wayp > (textInput.current = e)} @@ -254,6 +266,9 @@ WaypointEditor.displayName = 'WaypointEditor'; WaypointEditor.propTypes = propTypes; WaypointEditor.defaultProps = defaultProps; export default withOnyx({ + userLocation: { + key: ONYXKEYS.USER_LOCATION, + }, transaction: { key: ({route}) => `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(route, 'params.transactionID')}`, }, diff --git a/src/pages/iou/request/step/IOURequestStepWaypoint.js b/src/pages/iou/request/step/IOURequestStepWaypoint.js index 73d5b37e72ee..09617026576d 100644 --- a/src/pages/iou/request/step/IOURequestStepWaypoint.js +++ b/src/pages/iou/request/step/IOURequestStepWaypoint.js @@ -1,6 +1,5 @@ import {useNavigation} from '@react-navigation/native'; import lodashGet from 'lodash/get'; -import lodashIsNil from 'lodash/isNil'; import PropTypes from 'prop-types'; import React, {useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; @@ -16,6 +15,7 @@ import * as Expensicons from '@components/Icon/Expensicons'; import ScreenWrapper from '@components/ScreenWrapper'; import transactionPropTypes from '@components/transactionPropTypes'; import useLocalize from '@hooks/useLocalize'; +import useLocationBias from '@hooks/useLocationBias'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; @@ -97,7 +97,6 @@ function IOURequestStepWaypoint({ const parsedWaypointIndex = parseInt(pageIndex, 10); const allWaypoints = lodashGet(transaction, 'comment.waypoints', {}); const currentWaypoint = lodashGet(allWaypoints, `waypoint${pageIndex}`, {}); - const waypointCount = _.size(allWaypoints); const filledWaypointCount = _.size(_.filter(allWaypoints, (waypoint) => !_.isEmpty(waypoint))); @@ -112,58 +111,7 @@ function IOURequestStepWaypoint({ } }, [parsedWaypointIndex, waypointCount]); - // Construct the rectangular boundary based on user location and waypoints - const locationBias = useMemo(() => { - // If there are no filled wayPoints and if user's current location cannot be retrieved, - // it is futile to arrive at a biased location. Let's return - if (filledWaypointCount === 0 && _.isEmpty(userLocation)) { - return null; - } - - // Gather the longitudes and latitudes from filled waypoints. - const longitudes = _.filter( - _.map(allWaypoints, (waypoint) => { - if (!waypoint || lodashIsNil(waypoint.lng)) { - return; - } - return waypoint.lng; - }), - (lng) => lng, - ); - const latitudes = _.filter( - _.map(allWaypoints, (waypoint) => { - if (!waypoint || lodashIsNil(waypoint.lat)) { - return; - } - return waypoint.lat; - }), - (lat) => lat, - ); - - // When no filled waypoints are available but the current location of the user is available, - // let us consider the current user's location to construct a rectangular bound - if (filledWaypointCount === 0 && !_.isEmpty(userLocation)) { - longitudes.push(userLocation.longitude); - latitudes.push(userLocation.latitude); - } - - // Extend the rectangular bound by 0.5 degree (roughly around 25-30 miles in US) - const minLat = Math.min(...latitudes) - 0.5; - const minLng = Math.min(...longitudes) - 0.5; - const maxLat = Math.max(...latitudes) + 0.5; - const maxLng = Math.max(...longitudes) + 0.5; - - // Ensuring coordinates do not go out of range. - const south = minLat > -90 ? minLat : -90; - const west = minLng > -180 ? minLng : -180; - const north = maxLat < 90 ? maxLat : 90; - const east = maxLng < 180 ? maxLng : 180; - - // Format: rectangle:south,west|north,east - const rectFormat = `rectangle:${south},${west}|${north},${east}`; - return rectFormat; - }, [userLocation, filledWaypointCount, allWaypoints]); - + const locationBias = useLocationBias(allWaypoints, userLocation); const waypointAddress = lodashGet(currentWaypoint, 'address', ''); // Hide the menu when there is only start and finish waypoint const shouldShowThreeDotsButton = waypointCount > 2; diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.js b/src/pages/workspace/WorkspaceInviteMessagePage.js index d60f187fa7d2..00bdce30891a 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.js +++ b/src/pages/workspace/WorkspaceInviteMessagePage.js @@ -1,4 +1,3 @@ -import {isEmpty} from 'lodash'; import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useEffect, useState} from 'react'; @@ -226,7 +225,6 @@ export default compose( }, workspaceInviteMessageDraft: { key: ({route}) => `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MESSAGE_DRAFT}${route.params.policyID.toString()}`, - selector: (draft) => (isEmpty(draft) ? '' : draft), }, }), withNavigationFocus, diff --git a/src/pages/workspace/WorkspaceNewRoomPage.js b/src/pages/workspace/WorkspaceNewRoomPage.js index f0c3d3ada0c2..2576e9622b95 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.js +++ b/src/pages/workspace/WorkspaceNewRoomPage.js @@ -132,9 +132,7 @@ function WorkspaceNewRoomPage(props) { '', visibility, writeCapability || CONST.REPORT.WRITE_CAPABILITIES.ALL, - - // The room might contain all policy members so notifying always should be opt-in only. - CONST.REPORT.NOTIFICATION_PREFERENCE.DAILY, + CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, '', '', parsedWelcomeMessage, diff --git a/src/pages/workspace/WorkspacesListRow.tsx b/src/pages/workspace/WorkspacesListRow.tsx index 8bcc23faf550..d6bb3fb05385 100755 --- a/src/pages/workspace/WorkspacesListRow.tsx +++ b/src/pages/workspace/WorkspacesListRow.tsx @@ -1,20 +1,21 @@ import React, {useMemo} from 'react'; import {View} from 'react-native'; -import {ValueOf} from 'type-fest'; +import type {ValueOf} from 'type-fest'; import Avatar from '@components/Avatar'; import Icon from '@components/Icon'; import * as Illustrations from '@components/Icon/Illustrations'; -import {MenuItemProps} from '@components/MenuItem'; +import type {MenuItemProps} from '@components/MenuItem'; import Text from '@components/Text'; import ThreeDotsMenu from '@components/ThreeDotsMenu'; -import withCurrentUserPersonalDetails, {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails'; +import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails'; +import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; -import {AvatarSource} from '@libs/UserUtils'; +import type {AvatarSource} from '@libs/UserUtils'; import variables from '@styles/variables'; import CONST from '@src/CONST'; -import IconAsset from '@src/types/utils/IconAsset'; +import type IconAsset from '@src/types/utils/IconAsset'; type WorkspacesListRowProps = WithCurrentUserPersonalDetailsProps & { /** Name of the workspace */ diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.js b/src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.tsx similarity index 65% rename from src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.js rename to src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.tsx index b33311021e61..ede9a94d5159 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.js +++ b/src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.tsx @@ -1,33 +1,32 @@ -import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import * as Expensicons from '@components/Icon/Expensicons'; import * as Illustrations from '@components/Icon/Illustrations'; import Section from '@components/Section'; import Text from '@components/Text'; -import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; +import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Link from '@userActions/Link'; -const propTypes = { +type WorkspaceInvoicesFirstSectionProps = { /** The policy ID currently being configured */ - policyID: PropTypes.string.isRequired, - - ...withLocalizePropTypes, + policyID: string; }; -function WorkspaceInvoicesFirstSection(props) { +function WorkspaceInvoicesFirstSection({policyID}: WorkspaceInvoicesFirstSectionProps) { const styles = useThemeStyles(); + const {translate} = useLocalize(); + const sendInvoiceUrl = encodeURI('reports?param={"createInvoice":true}'); - const viewAllInvoicesUrl = `reports?policyID=${props.policyID}&from=all&type=invoice&showStates=Open,Processing,Approved,Reimbursed,Archived&isAdvancedFilterMode=true`; + const viewAllInvoicesUrl = `reports?policyID=${policyID}&from=all&type=invoice&showStates=Open,Processing,Approved,Reimbursed,Archived&isAdvancedFilterMode=true`; return (
Link.openOldDotLink(sendInvoiceUrl), icon: Expensicons.Send, shouldShowRightIcon: true, @@ -36,7 +35,7 @@ function WorkspaceInvoicesFirstSection(props) { link: () => Link.buildOldDotURL(sendInvoiceUrl), }, { - title: props.translate('workspace.invoices.viewAllInvoices'), + title: translate('workspace.invoices.viewAllInvoices'), onPress: () => Link.openOldDotLink(viewAllInvoicesUrl), icon: Expensicons.Invoice, shouldShowRightIcon: true, @@ -48,13 +47,12 @@ function WorkspaceInvoicesFirstSection(props) { containerStyles={[styles.cardSection]} > - {props.translate('workspace.invoices.invoiceFirstSectionCopy')} + {translate('workspace.invoices.invoiceFirstSectionCopy')}
); } -WorkspaceInvoicesFirstSection.propTypes = propTypes; WorkspaceInvoicesFirstSection.displayName = 'WorkspaceInvoicesFirstSection'; -export default withLocalize(WorkspaceInvoicesFirstSection); +export default WorkspaceInvoicesFirstSection; diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.js b/src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.tsx similarity index 59% rename from src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.js rename to src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.tsx index 25a97ac93442..b382f0d7c609 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.js +++ b/src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.tsx @@ -1,37 +1,36 @@ -import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import ConnectBankAccountButton from '@components/ConnectBankAccountButton'; import * as Illustrations from '@components/Icon/Illustrations'; import Section from '@components/Section'; import Text from '@components/Text'; -import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; +import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import WorkspaceInvoicesFirstSection from './WorkspaceInvoicesFirstSection'; -const propTypes = { +type WorkspaceInvoicesNoVBAViewProps = { /** The policy ID currently being configured */ - policyID: PropTypes.string.isRequired, - - ...withLocalizePropTypes, + policyID: string; }; -function WorkspaceInvoicesNoVBAView(props) { +function WorkspaceInvoicesNoVBAView({policyID}: WorkspaceInvoicesNoVBAViewProps) { const styles = useThemeStyles(); + const {translate} = useLocalize(); + return ( <> - +
- {props.translate('workspace.invoices.unlockNoVBACopy')} + {translate('workspace.invoices.unlockNoVBACopy')}
@@ -39,7 +38,6 @@ function WorkspaceInvoicesNoVBAView(props) { ); } -WorkspaceInvoicesNoVBAView.propTypes = propTypes; WorkspaceInvoicesNoVBAView.displayName = 'WorkspaceInvoicesNoVBAView'; -export default withLocalize(WorkspaceInvoicesNoVBAView); +export default WorkspaceInvoicesNoVBAView; diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesPage.js b/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx similarity index 50% rename from src/pages/workspace/invoices/WorkspaceInvoicesPage.js rename to src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx index 8bc0c4484100..2126409231b8 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoicesPage.js +++ b/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx @@ -1,33 +1,26 @@ -import PropTypes from 'prop-types'; +import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; -import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; +import useLocalize from '@hooks/useLocalize'; +import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; import CONST from '@src/CONST'; +import type SCREENS from '@src/SCREENS'; import WorkspaceInvoicesNoVBAView from './WorkspaceInvoicesNoVBAView'; import WorkspaceInvoicesVBAView from './WorkspaceInvoicesVBAView'; -const propTypes = { - /** The route object passed to this page from the navigator */ - route: PropTypes.shape({ - /** Each parameter passed via the URL */ - params: PropTypes.shape({ - /** The policyID that is being configured */ - policyID: PropTypes.string.isRequired, - }).isRequired, - }).isRequired, +type WorkspaceInvoicesPageProps = StackScreenProps; - ...withLocalizePropTypes, -}; +function WorkspaceInvoicesPage({route}: WorkspaceInvoicesPageProps) { + const {translate} = useLocalize(); -function WorkspaceInvoicesPage(props) { return ( - {(hasVBA, policyID) => ( + {(hasVBA: boolean, policyID: string) => ( <> {!hasVBA && } {hasVBA && } @@ -37,7 +30,6 @@ function WorkspaceInvoicesPage(props) { ); } -WorkspaceInvoicesPage.propTypes = propTypes; WorkspaceInvoicesPage.displayName = 'WorkspaceInvoicesPage'; -export default withLocalize(WorkspaceInvoicesPage); +export default WorkspaceInvoicesPage; diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesVBAView.js b/src/pages/workspace/invoices/WorkspaceInvoicesVBAView.tsx similarity index 58% rename from src/pages/workspace/invoices/WorkspaceInvoicesVBAView.js rename to src/pages/workspace/invoices/WorkspaceInvoicesVBAView.tsx index c5e047f6291b..5c62e16eaa4a 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoicesVBAView.js +++ b/src/pages/workspace/invoices/WorkspaceInvoicesVBAView.tsx @@ -1,36 +1,34 @@ -import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import * as Expensicons from '@components/Icon/Expensicons'; import * as Illustrations from '@components/Icon/Illustrations'; import Section from '@components/Section'; import Text from '@components/Text'; -import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; +import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Link from '@userActions/Link'; import WorkspaceInvoicesFirstSection from './WorkspaceInvoicesFirstSection'; -const propTypes = { - /** The policy ID currently being configured */ - policyID: PropTypes.string.isRequired, - - ...withLocalizePropTypes, +type WorkspaceInvoicesVBAViewProps = { + /** The polgicy ID currently being configured */ + policyID: string; }; -function WorkspaceInvoicesVBAView(props) { +function WorkspaceInvoicesVBAView({policyID}: WorkspaceInvoicesVBAViewProps) { + const {translate} = useLocalize(); const styles = useThemeStyles(); - const viewUnpaidInvoicesUrl = `reports?policyID=${props.policyID}&from=all&type=invoice&showStates=Processing&isAdvancedFilterMode=true`; + const viewUnpaidInvoicesUrl = `reports?policyID=${policyID}&from=all&type=invoice&showStates=Processing&isAdvancedFilterMode=true`; return ( <> - +
Link.openOldDotLink(viewUnpaidInvoicesUrl), icon: Expensicons.Hourglass, shouldShowRightIcon: true, @@ -41,14 +39,13 @@ function WorkspaceInvoicesVBAView(props) { ]} > - {props.translate('workspace.invoices.unlockVBACopy')} + {translate('workspace.invoices.unlockVBACopy')}
); } -WorkspaceInvoicesVBAView.propTypes = propTypes; WorkspaceInvoicesVBAView.displayName = 'WorkspaceInvoicesVBAView'; -export default withLocalize(WorkspaceInvoicesVBAView); +export default WorkspaceInvoicesVBAView; diff --git a/src/pages/workspace/withPolicy.tsx b/src/pages/workspace/withPolicy.tsx index 93062d0ef07a..ec38b61fb0dc 100644 --- a/src/pages/workspace/withPolicy.tsx +++ b/src/pages/workspace/withPolicy.tsx @@ -1,12 +1,15 @@ -import {RouteProp, useNavigationState} from '@react-navigation/native'; +import type {RouteProp} from '@react-navigation/native'; +import {useNavigationState} from '@react-navigation/native'; import PropTypes from 'prop-types'; -import React, {ComponentType, ForwardedRef, forwardRef, RefAttributes} from 'react'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React, {forwardRef} from 'react'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import policyMemberPropType from '@pages/policyMemberPropType'; import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import * as OnyxTypes from '@src/types/onyx'; +import type * as OnyxTypes from '@src/types/onyx'; type PolicyRoute = RouteProp<{params: {policyID: string}}>; diff --git a/src/pages/workspace/withPolicyAndFullscreenLoading.tsx b/src/pages/workspace/withPolicyAndFullscreenLoading.tsx index 3e8bd3bdddb4..892facb92823 100644 --- a/src/pages/workspace/withPolicyAndFullscreenLoading.tsx +++ b/src/pages/workspace/withPolicyAndFullscreenLoading.tsx @@ -1,10 +1,13 @@ import isEmpty from 'lodash/isEmpty'; -import React, {ComponentType, ForwardedRef, forwardRef, RefAttributes} from 'react'; -import {OnyxEntry, withOnyx} from 'react-native-onyx'; +import type {ComponentType, ForwardedRef, RefAttributes} from 'react'; +import React, {forwardRef} from 'react'; +import type {OnyxEntry} from 'react-native-onyx'; +import {withOnyx} from 'react-native-onyx'; import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import compose from '@libs/compose'; import ONYXKEYS from '@src/ONYXKEYS'; -import withPolicy, {policyDefaultProps, WithPolicyOnyxProps, WithPolicyProps} from './withPolicy'; +import type {WithPolicyOnyxProps, WithPolicyProps} from './withPolicy'; +import withPolicy, {policyDefaultProps} from './withPolicy'; type WithPolicyAndFullscreenLoadingOnyxProps = { /** Indicated whether the report data is loading */ diff --git a/src/stories/Breadcrumbs.stories.tsx b/src/stories/Breadcrumbs.stories.tsx index 60e1900534f9..38cb5192b105 100644 --- a/src/stories/Breadcrumbs.stories.tsx +++ b/src/stories/Breadcrumbs.stories.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import Breadcrumbs, {BreadcrumbsProps} from '@components/Breadcrumbs'; +import type {BreadcrumbsProps} from '@components/Breadcrumbs'; +import Breadcrumbs from '@components/Breadcrumbs'; import CONST from '@src/CONST'; /** diff --git a/src/stories/Search.stories.tsx b/src/stories/Search.stories.tsx index a501fc2610b0..58c3eb2561a2 100644 --- a/src/stories/Search.stories.tsx +++ b/src/stories/Search.stories.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import Search, {SearchProps} from '@components/Search'; +import type {SearchProps} from '@components/Search'; +import Search from '@components/Search'; /** * We use the Component Story Format for writing stories. Follow the docs here: diff --git a/src/styles/index.ts b/src/styles/index.ts index fb1919b9f5d3..ce39e69a445a 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -1,17 +1,18 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import {LineLayerStyleProps} from '@rnmapbox/maps/src/utils/MapboxStyles'; +import type {LineLayerStyleProps} from '@rnmapbox/maps/src/utils/MapboxStyles'; import lodashClamp from 'lodash/clamp'; -import {LineLayer} from 'react-map-gl'; -import {AnimatableNumericValue, Animated, ImageStyle, StyleSheet, TextStyle, ViewStyle} from 'react-native'; -import {CustomAnimation} from 'react-native-animatable'; -import {PickerStyle} from 'react-native-picker-select'; -import {MixedStyleDeclaration, MixedStyleRecord} from 'react-native-render-html'; -import DotLottieAnimation from '@components/LottieAnimations/types'; +import type {LineLayer} from 'react-map-gl'; +import type {AnimatableNumericValue, Animated, ImageStyle, TextStyle, ViewStyle} from 'react-native'; +import {StyleSheet} from 'react-native'; +import type {CustomAnimation} from 'react-native-animatable'; +import type {PickerStyle} from 'react-native-picker-select'; +import type {MixedStyleDeclaration, MixedStyleRecord} from 'react-native-render-html'; +import type DotLottieAnimation from '@components/LottieAnimations/types'; import * as Browser from '@libs/Browser'; import CONST from '@src/CONST'; import {defaultTheme} from './theme'; import colors from './theme/colors'; -import {type ThemeColors} from './theme/types'; +import type {ThemeColors} from './theme/types'; import addOutlineWidth from './utils/addOutlineWidth'; import borders from './utils/borders'; import codeStyles from './utils/codeStyles'; @@ -2875,7 +2876,7 @@ const styles = (theme: ThemeColors) => smallEditIcon: { alignItems: 'center', - backgroundColor: theme.buttonHoveredBG, + backgroundColor: theme.buttonDefaultBG, borderColor: theme.appBG, borderRadius: 14, borderWidth: 3, diff --git a/src/styles/theme/colors.ts b/src/styles/theme/colors.ts index 061336d2d114..0312e6613baf 100644 --- a/src/styles/theme/colors.ts +++ b/src/styles/theme/colors.ts @@ -1,4 +1,4 @@ -import {Color} from './types'; +import type {Color} from './types'; /** * DO NOT import colors.js into files. Use the theme switching hooks and HOCs instead. diff --git a/src/styles/theme/context/ThemeContext.ts b/src/styles/theme/context/ThemeContext.ts index 64cd805b3f59..8a1574af0e99 100644 --- a/src/styles/theme/context/ThemeContext.ts +++ b/src/styles/theme/context/ThemeContext.ts @@ -1,5 +1,5 @@ import React from 'react'; -import {type ThemeColors} from '@styles/theme/types'; +import type {ThemeColors} from '@styles/theme/types'; import {defaultTheme} from '..'; const ThemeContext = React.createContext(defaultTheme); diff --git a/src/styles/theme/context/ThemeIllustrationsContext.ts b/src/styles/theme/context/ThemeIllustrationsContext.ts index b70cf6aa5ea2..f762a35b0800 100644 --- a/src/styles/theme/context/ThemeIllustrationsContext.ts +++ b/src/styles/theme/context/ThemeIllustrationsContext.ts @@ -1,6 +1,6 @@ import React from 'react'; import {DefaultIllustrations} from '@styles/theme/illustrations'; -import {IllustrationsType} from '@styles/theme/illustrations/types'; +import type {IllustrationsType} from '@styles/theme/illustrations/types'; const ThemeIllustrationsContext = React.createContext(DefaultIllustrations); diff --git a/src/styles/theme/illustrations/index.ts b/src/styles/theme/illustrations/index.ts index 9526dbcd1023..2686f4205351 100644 --- a/src/styles/theme/illustrations/index.ts +++ b/src/styles/theme/illustrations/index.ts @@ -1,4 +1,4 @@ -import {ThemePreferenceWithoutSystem} from '@styles/theme/types'; +import type {ThemePreferenceWithoutSystem} from '@styles/theme/types'; import CONST from '@src/CONST'; import darkIllustrations from './themes/dark'; import lightIllustrations from './themes/light'; diff --git a/src/styles/theme/illustrations/themes/dark.ts b/src/styles/theme/illustrations/themes/dark.ts index 2a4390ae2520..2920081ac137 100644 --- a/src/styles/theme/illustrations/themes/dark.ts +++ b/src/styles/theme/illustrations/themes/dark.ts @@ -1,7 +1,7 @@ import EmptyStateBackgroundImage from '@assets/images/themeDependent/empty-state_background-fade-dark.png'; import ExampleCheckEN from '@assets/images/themeDependent/example-check-image-dark-en.png'; import ExampleCheckES from '@assets/images/themeDependent/example-check-image-dark-es.png'; -import {IllustrationsType} from '@styles/theme/illustrations/types'; +import type {IllustrationsType} from '@styles/theme/illustrations/types'; const illustrations = { EmptyStateBackgroundImage, diff --git a/src/styles/theme/illustrations/themes/light.ts b/src/styles/theme/illustrations/themes/light.ts index f41114a04efa..6eb9c11851e4 100644 --- a/src/styles/theme/illustrations/themes/light.ts +++ b/src/styles/theme/illustrations/themes/light.ts @@ -1,7 +1,7 @@ import EmptyStateBackgroundImage from '@assets/images/themeDependent/empty-state_background-fade-light.png'; import ExampleCheckEN from '@assets/images/themeDependent/example-check-image-light-en.png'; import ExampleCheckES from '@assets/images/themeDependent/example-check-image-light-es.png'; -import {IllustrationsType} from '@styles/theme/illustrations/types'; +import type {IllustrationsType} from '@styles/theme/illustrations/types'; const illustrations = { EmptyStateBackgroundImage, diff --git a/src/styles/theme/illustrations/types.ts b/src/styles/theme/illustrations/types.ts index bda98dc55fbf..b37ff17965e2 100644 --- a/src/styles/theme/illustrations/types.ts +++ b/src/styles/theme/illustrations/types.ts @@ -1,4 +1,4 @@ -import {ImageSourcePropType} from 'react-native'; +import type {ImageSourcePropType} from 'react-native'; type IllustrationsType = { EmptyStateBackgroundImage: ImageSourcePropType; diff --git a/src/styles/theme/index.ts b/src/styles/theme/index.ts index c8c3a6ec12c1..f1078e231c9e 100644 --- a/src/styles/theme/index.ts +++ b/src/styles/theme/index.ts @@ -1,7 +1,7 @@ import CONST from '@src/CONST'; import darkTheme from './themes/dark'; import lightTheme from './themes/light'; -import {type ThemeColors, ThemePreferenceWithoutSystem} from './types'; +import type {ThemeColors, ThemePreferenceWithoutSystem} from './types'; const themes = { [CONST.THEME.LIGHT]: lightTheme, diff --git a/src/styles/theme/themes/dark.ts b/src/styles/theme/themes/dark.ts index a2954a4fca03..8ac7b0a2359c 100644 --- a/src/styles/theme/themes/dark.ts +++ b/src/styles/theme/themes/dark.ts @@ -1,5 +1,5 @@ import colors from '@styles/theme/colors'; -import {type ThemeColors} from '@styles/theme/types'; +import type {ThemeColors} from '@styles/theme/types'; import CONST from '@src/CONST'; import SCREENS from '@src/SCREENS'; diff --git a/src/styles/theme/themes/light.ts b/src/styles/theme/themes/light.ts index d4819898b83c..663b94aa0fc7 100644 --- a/src/styles/theme/themes/light.ts +++ b/src/styles/theme/themes/light.ts @@ -1,5 +1,5 @@ import colors from '@styles/theme/colors'; -import {type ThemeColors} from '@styles/theme/types'; +import type {ThemeColors} from '@styles/theme/types'; import CONST from '@src/CONST'; import SCREENS from '@src/SCREENS'; diff --git a/src/styles/theme/types.ts b/src/styles/theme/types.ts index b443295b8167..2a1bb79e2efb 100644 --- a/src/styles/theme/types.ts +++ b/src/styles/theme/types.ts @@ -1,5 +1,5 @@ -import CONST from '@src/CONST'; -import {type ColorScheme, type StatusBarStyle} from '..'; +import type CONST from '@src/CONST'; +import type {ColorScheme, StatusBarStyle} from '..'; type Color = string; diff --git a/src/styles/utils/addOutlineWidth/index.native.ts b/src/styles/utils/addOutlineWidth/index.native.ts index d081e2a9af70..9a9942951cd0 100644 --- a/src/styles/utils/addOutlineWidth/index.native.ts +++ b/src/styles/utils/addOutlineWidth/index.native.ts @@ -2,7 +2,7 @@ * Native platforms don't support the "addOutlineWidth" property, so this * function is a no-op */ -import AddOutlineWidth from './types'; +import type AddOutlineWidth from './types'; // eslint-disable-next-line @typescript-eslint/naming-convention const addOutlineWidth: AddOutlineWidth = (_theme, obj) => obj; diff --git a/src/styles/utils/addOutlineWidth/index.ts b/src/styles/utils/addOutlineWidth/index.ts index c1ac1af52a8b..104f3ce90516 100644 --- a/src/styles/utils/addOutlineWidth/index.ts +++ b/src/styles/utils/addOutlineWidth/index.ts @@ -2,7 +2,7 @@ * Web and desktop platforms support the "addOutlineWidth" property, so it * can be added to the object */ -import AddOutlineWidth from './types'; +import type AddOutlineWidth from './types'; /** * Adds the addOutlineWidth property to an object to be used when styling diff --git a/src/styles/utils/addOutlineWidth/types.ts b/src/styles/utils/addOutlineWidth/types.ts index f6b9be63893c..45975b72dc8a 100644 --- a/src/styles/utils/addOutlineWidth/types.ts +++ b/src/styles/utils/addOutlineWidth/types.ts @@ -1,5 +1,5 @@ -import {TextStyle} from 'react-native'; -import {type ThemeColors} from '@styles/theme/types'; +import type {TextStyle} from 'react-native'; +import type {ThemeColors} from '@styles/theme/types'; type AddOutlineWidth = (theme: ThemeColors, obj: TextStyle, val?: number, hasError?: boolean) => TextStyle; diff --git a/src/styles/utils/borders.ts b/src/styles/utils/borders.ts index 9cd02dcd22ae..26fdf6415fc7 100644 --- a/src/styles/utils/borders.ts +++ b/src/styles/utils/borders.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; /** * All styles should be incremented by units of 4. diff --git a/src/styles/utils/cardStyles/index.native.ts b/src/styles/utils/cardStyles/index.native.ts index 94b8758efd05..73ebccfd4ab4 100644 --- a/src/styles/utils/cardStyles/index.native.ts +++ b/src/styles/utils/cardStyles/index.native.ts @@ -1,4 +1,4 @@ -import GetCardStyles from './types'; +import type GetCardStyles from './types'; const getCardStyles: GetCardStyles = () => ({}); diff --git a/src/styles/utils/cardStyles/index.ts b/src/styles/utils/cardStyles/index.ts index 77a00695d20a..3a1f778f36f4 100644 --- a/src/styles/utils/cardStyles/index.ts +++ b/src/styles/utils/cardStyles/index.ts @@ -1,5 +1,5 @@ import positioning from '@styles/utils/positioning'; -import GetCardStyles from './types'; +import type GetCardStyles from './types'; /** * Get card style for cardStyleInterpolator diff --git a/src/styles/utils/cardStyles/types.ts b/src/styles/utils/cardStyles/types.ts index 134b93eae32f..38c761c8bf4f 100644 --- a/src/styles/utils/cardStyles/types.ts +++ b/src/styles/utils/cardStyles/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type GetCardStyles = (screenWidth: number) => ViewStyle; diff --git a/src/styles/utils/codeStyles/index.android.ts b/src/styles/utils/codeStyles/index.android.ts index 1912f0ad7489..0ac77729c83c 100644 --- a/src/styles/utils/codeStyles/index.android.ts +++ b/src/styles/utils/codeStyles/index.android.ts @@ -1,4 +1,4 @@ -import {CodeTextStyles, CodeWordStyles, CodeWordWrapperStyles} from './types'; +import type {CodeTextStyles, CodeWordStyles, CodeWordWrapperStyles} from './types'; const codeWordWrapper: CodeWordWrapperStyles = { height: 20, diff --git a/src/styles/utils/codeStyles/index.ios.ts b/src/styles/utils/codeStyles/index.ios.ts index ec87e3b6427b..05e2b55ec205 100644 --- a/src/styles/utils/codeStyles/index.ios.ts +++ b/src/styles/utils/codeStyles/index.ios.ts @@ -1,4 +1,4 @@ -import {CodeTextStyles, CodeWordStyles, CodeWordWrapperStyles} from './types'; +import type {CodeTextStyles, CodeWordStyles, CodeWordWrapperStyles} from './types'; const codeWordWrapper: CodeWordWrapperStyles = { height: 22, diff --git a/src/styles/utils/codeStyles/index.ts b/src/styles/utils/codeStyles/index.ts index 45f669b0adaa..80a66df95c7c 100644 --- a/src/styles/utils/codeStyles/index.ts +++ b/src/styles/utils/codeStyles/index.ts @@ -1,4 +1,4 @@ -import {CodeTextStyles, CodeWordStyles, CodeWordWrapperStyles} from './types'; +import type {CodeTextStyles, CodeWordStyles, CodeWordWrapperStyles} from './types'; // We do not need these on Web/Desktop as their implementation defer from Native devices so just noop them const codeWordWrapper: CodeWordWrapperStyles = {}; diff --git a/src/styles/utils/codeStyles/types.ts b/src/styles/utils/codeStyles/types.ts index f223d980e67b..245676b0a331 100644 --- a/src/styles/utils/codeStyles/types.ts +++ b/src/styles/utils/codeStyles/types.ts @@ -1,4 +1,4 @@ -import {TextStyle, ViewStyle} from 'react-native'; +import type {TextStyle, ViewStyle} from 'react-native'; type CodeWordWrapperStyles = ViewStyle; type CodeWordStyles = ViewStyle; diff --git a/src/styles/utils/containerComposeStyles/index.native.ts b/src/styles/utils/containerComposeStyles/index.native.ts index 3104b6878b2a..de95087ab93e 100644 --- a/src/styles/utils/containerComposeStyles/index.native.ts +++ b/src/styles/utils/containerComposeStyles/index.native.ts @@ -1,4 +1,4 @@ -import ContainerComposeStyles from './types'; +import type ContainerComposeStyles from './types'; const containerComposeStyles: ContainerComposeStyles = (styles) => [styles.textInputComposeSpacing]; diff --git a/src/styles/utils/containerComposeStyles/index.ts b/src/styles/utils/containerComposeStyles/index.ts index c6161fd2d9df..3f858292afee 100644 --- a/src/styles/utils/containerComposeStyles/index.ts +++ b/src/styles/utils/containerComposeStyles/index.ts @@ -1,4 +1,4 @@ -import ContainerComposeStyles from './types'; +import type ContainerComposeStyles from './types'; // We need to set paddingVertical = 0 on web to avoid displaying a normal pointer on some parts of compose box when not in focus const containerComposeStyles: ContainerComposeStyles = (styles) => [styles.textInputComposeSpacing, {paddingVertical: 0}]; diff --git a/src/styles/utils/containerComposeStyles/types.ts b/src/styles/utils/containerComposeStyles/types.ts index 2b2d23b7f8c1..0b3d598ad042 100644 --- a/src/styles/utils/containerComposeStyles/types.ts +++ b/src/styles/utils/containerComposeStyles/types.ts @@ -1,5 +1,5 @@ -import {ViewStyle} from 'react-native'; -import {type ThemeStyles} from '@styles/index'; +import type {ViewStyle} from 'react-native'; +import type {ThemeStyles} from '@styles/index'; type ContainerComposeStyles = (styles: ThemeStyles) => ViewStyle[]; diff --git a/src/styles/utils/cursor/index.native.ts b/src/styles/utils/cursor/index.native.ts index 67416e750f36..74b9b72bd1d0 100644 --- a/src/styles/utils/cursor/index.native.ts +++ b/src/styles/utils/cursor/index.native.ts @@ -1,4 +1,4 @@ -import CursorStyles from './types'; +import type CursorStyles from './types'; const cursor: CursorStyles = { cursorDefault: {}, diff --git a/src/styles/utils/cursor/index.ts b/src/styles/utils/cursor/index.ts index e3f85107f16a..958e45749ebb 100644 --- a/src/styles/utils/cursor/index.ts +++ b/src/styles/utils/cursor/index.ts @@ -1,4 +1,4 @@ -import CursorStyles from './types'; +import type CursorStyles from './types'; const cursor: CursorStyles = { cursorDefault: { diff --git a/src/styles/utils/cursor/types.ts b/src/styles/utils/cursor/types.ts index e9cfc120b161..7ffac48612fb 100644 --- a/src/styles/utils/cursor/types.ts +++ b/src/styles/utils/cursor/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type CursorStylesKeys = | 'cursorDefault' diff --git a/src/styles/utils/display.ts b/src/styles/utils/display.ts index f14a25d641b1..82b8c87b0980 100644 --- a/src/styles/utils/display.ts +++ b/src/styles/utils/display.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; /** * Display utilities with Bootstrap inspired naming. diff --git a/src/styles/utils/editedLabelStyles/index.native.ts b/src/styles/utils/editedLabelStyles/index.native.ts index 3e43004a8a13..d49857ba28eb 100644 --- a/src/styles/utils/editedLabelStyles/index.native.ts +++ b/src/styles/utils/editedLabelStyles/index.native.ts @@ -1,4 +1,4 @@ -import EditedLabelStyles from './types'; +import type EditedLabelStyles from './types'; const editedLabelStyles: EditedLabelStyles = {}; diff --git a/src/styles/utils/editedLabelStyles/index.ts b/src/styles/utils/editedLabelStyles/index.ts index 427918af1202..9397966a88a5 100644 --- a/src/styles/utils/editedLabelStyles/index.ts +++ b/src/styles/utils/editedLabelStyles/index.ts @@ -1,6 +1,6 @@ import display from '@styles/utils/display'; import flex from '@styles/utils/flex'; -import EditedLabelStyles from './types'; +import type EditedLabelStyles from './types'; const editedLabelStyles: EditedLabelStyles = { ...display.dInlineFlex, diff --git a/src/styles/utils/editedLabelStyles/types.ts b/src/styles/utils/editedLabelStyles/types.ts index 20bcc8c55f15..6f263e2d9e64 100644 --- a/src/styles/utils/editedLabelStyles/types.ts +++ b/src/styles/utils/editedLabelStyles/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type EditedLabelStyles = TextStyle; diff --git a/src/styles/utils/flex.ts b/src/styles/utils/flex.ts index 6c7541a3ef46..38b68bddd38d 100644 --- a/src/styles/utils/flex.ts +++ b/src/styles/utils/flex.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; /** * Flex layout utility styles with Bootstrap inspired naming. diff --git a/src/styles/utils/fontFamily/bold/index.android.ts b/src/styles/utils/fontFamily/bold/index.android.ts index 828b9425e8d4..89f116f18c20 100644 --- a/src/styles/utils/fontFamily/bold/index.android.ts +++ b/src/styles/utils/fontFamily/bold/index.android.ts @@ -1,4 +1,4 @@ -import FontFamilyBoldStyles from './types'; +import type FontFamilyBoldStyles from './types'; const singleBold: FontFamilyBoldStyles = 'ExpensifyNeue-Bold'; const multiBold: FontFamilyBoldStyles = 'ExpensifyNeue-Bold'; diff --git a/src/styles/utils/fontFamily/bold/index.ios.ts b/src/styles/utils/fontFamily/bold/index.ios.ts index 31b7e3d82c05..a5dfea7ecd2e 100644 --- a/src/styles/utils/fontFamily/bold/index.ios.ts +++ b/src/styles/utils/fontFamily/bold/index.ios.ts @@ -1,4 +1,4 @@ -import FontFamilyBoldStyles from './types'; +import type FontFamilyBoldStyles from './types'; const singleBold: FontFamilyBoldStyles = 'ExpensifyNeue-Regular'; const multiBold: FontFamilyBoldStyles = 'ExpensifyNeue-Regular'; diff --git a/src/styles/utils/fontFamily/bold/index.ts b/src/styles/utils/fontFamily/bold/index.ts index c416bff3aadc..d07951acd0f5 100644 --- a/src/styles/utils/fontFamily/bold/index.ts +++ b/src/styles/utils/fontFamily/bold/index.ts @@ -1,4 +1,4 @@ -import FontFamilyBoldStyles from './types'; +import type FontFamilyBoldStyles from './types'; const singleBold: FontFamilyBoldStyles = 'ExpensifyNeue-Regular'; const multiBold: FontFamilyBoldStyles = 'ExpensifyNeue-Regular, Segoe UI Emoji, Noto Color Emoji'; diff --git a/src/styles/utils/fontFamily/bold/types.ts b/src/styles/utils/fontFamily/bold/types.ts index 258b23de94a2..b393618102a5 100644 --- a/src/styles/utils/fontFamily/bold/types.ts +++ b/src/styles/utils/fontFamily/bold/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type FontFamilyBoldStyles = NonNullable; diff --git a/src/styles/utils/fontFamily/multiFontFamily.ts b/src/styles/utils/fontFamily/multiFontFamily.ts index 5bd89e0d4bcb..902b94021b32 100644 --- a/src/styles/utils/fontFamily/multiFontFamily.ts +++ b/src/styles/utils/fontFamily/multiFontFamily.ts @@ -1,7 +1,7 @@ import getOperatingSystem from '@libs/getOperatingSystem'; import CONST from '@src/CONST'; import {multiBold} from './bold'; -import FontFamilyStyles from './types'; +import type FontFamilyStyles from './types'; // In windows and ubuntu, we need some extra system fonts for emojis to work properly // otherwise few of them will appear as black and white diff --git a/src/styles/utils/fontFamily/singleFontFamily.ts b/src/styles/utils/fontFamily/singleFontFamily.ts index 6d5b05a5b0aa..71294c55ffaa 100644 --- a/src/styles/utils/fontFamily/singleFontFamily.ts +++ b/src/styles/utils/fontFamily/singleFontFamily.ts @@ -1,5 +1,5 @@ import {singleBold} from './bold'; -import FontFamilyStyles from './types'; +import type FontFamilyStyles from './types'; const fontFamily: FontFamilyStyles = { EXP_NEUE_ITALIC: 'ExpensifyNeue-Italic', diff --git a/src/styles/utils/fontFamily/types.ts b/src/styles/utils/fontFamily/types.ts index c688f40927be..724f92d4edc7 100644 --- a/src/styles/utils/fontFamily/types.ts +++ b/src/styles/utils/fontFamily/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type FontFamilyKeys = | 'EXP_NEUE_ITALIC' diff --git a/src/styles/utils/fontWeight/bold/index.android.ts b/src/styles/utils/fontWeight/bold/index.android.ts index 3119e0f391cd..f4364eeb1e80 100644 --- a/src/styles/utils/fontWeight/bold/index.android.ts +++ b/src/styles/utils/fontWeight/bold/index.android.ts @@ -1,4 +1,4 @@ -import FontWeightBoldStyles from './types'; +import type FontWeightBoldStyles from './types'; // Android has ExpensifyNeue-Bold, but fontWeight: '700' will result in // an incorrect font displaying on Android diff --git a/src/styles/utils/fontWeight/bold/index.ts b/src/styles/utils/fontWeight/bold/index.ts index 45de49abb35b..ecb6cb5ce2b1 100644 --- a/src/styles/utils/fontWeight/bold/index.ts +++ b/src/styles/utils/fontWeight/bold/index.ts @@ -1,4 +1,4 @@ -import FontWeightBoldStyles from './types'; +import type FontWeightBoldStyles from './types'; // Web only has ExpensifyNeue-Regular so to achieve bold we need to add this fontWeight const bold: FontWeightBoldStyles = '700'; diff --git a/src/styles/utils/fontWeight/bold/types.ts b/src/styles/utils/fontWeight/bold/types.ts index 00e72d0e879c..624deb999a43 100644 --- a/src/styles/utils/fontWeight/bold/types.ts +++ b/src/styles/utils/fontWeight/bold/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type FontWeightBoldStyles = NonNullable; diff --git a/src/styles/utils/generators/ModalStyleUtils.ts b/src/styles/utils/generators/ModalStyleUtils.ts index 67faec504d61..3dfb1e67e038 100644 --- a/src/styles/utils/generators/ModalStyleUtils.ts +++ b/src/styles/utils/generators/ModalStyleUtils.ts @@ -1,10 +1,10 @@ -import {ViewStyle} from 'react-native'; -import {ModalProps} from 'react-native-modal'; -import {ValueOf} from 'type-fest'; -import {ThemeStyles} from '@styles/index'; +import type {ViewStyle} from 'react-native'; +import type {ModalProps} from 'react-native-modal'; +import type {ValueOf} from 'type-fest'; +import type {ThemeStyles} from '@styles/index'; import variables from '@styles/variables'; import CONST from '@src/CONST'; -import StyleUtilGenerator from './types'; +import type StyleUtilGenerator from './types'; function getCenteredModalStyles(styles: ThemeStyles, windowWidth: number, isSmallScreenWidth: boolean, isFullScreenWhenSmall = false): ViewStyle { const modalStyles = styles.centeredModalStyles(isSmallScreenWidth, isFullScreenWhenSmall); diff --git a/src/styles/utils/generators/ReportActionContextMenuStyleUtils.ts b/src/styles/utils/generators/ReportActionContextMenuStyleUtils.ts index 10904fca05cd..e45b5db98b53 100644 --- a/src/styles/utils/generators/ReportActionContextMenuStyleUtils.ts +++ b/src/styles/utils/generators/ReportActionContextMenuStyleUtils.ts @@ -1,8 +1,8 @@ -import {ViewStyle} from 'react-native'; -import {ThemeStyles} from '@styles/index'; -import {type ThemeColors} from '@styles/theme/types'; +import type {ViewStyle} from 'react-native'; +import type {ThemeStyles} from '@styles/index'; +import type {ThemeColors} from '@styles/theme/types'; import variables from '@styles/variables'; -import StyleUtilGenerator from './types'; +import type StyleUtilGenerator from './types'; const getDefaultWrapperStyle = (theme: ThemeColors): ViewStyle => ({ backgroundColor: theme.componentBG, diff --git a/src/styles/utils/generators/TooltipStyleUtils.ts b/src/styles/utils/generators/TooltipStyleUtils.ts index 0e9fda1a3388..90cef9a6f568 100644 --- a/src/styles/utils/generators/TooltipStyleUtils.ts +++ b/src/styles/utils/generators/TooltipStyleUtils.ts @@ -1,10 +1,11 @@ -import {Animated, TextStyle, View, ViewStyle} from 'react-native'; +import type {TextStyle, View, ViewStyle} from 'react-native'; +import {Animated} from 'react-native'; import fontFamily from '@styles/utils/fontFamily'; import positioning from '@styles/utils/positioning'; import roundToNearestMultipleOfFour from '@styles/utils/roundToNearestMultipleOfFour'; import spacing from '@styles/utils/spacing'; import variables from '@styles/variables'; -import StyleUtilGenerator from './types'; +import type StyleUtilGenerator from './types'; /** This defines the proximity with the edge of the window in which tooltips should not be displayed. * If a tooltip is too close to the edge of the screen, we'll shift it towards the center. */ diff --git a/src/styles/utils/generators/types.ts b/src/styles/utils/generators/types.ts index ca6a630d94c5..dd346a3fefc6 100644 --- a/src/styles/utils/generators/types.ts +++ b/src/styles/utils/generators/types.ts @@ -1,5 +1,5 @@ -import {ThemeStyles} from '@styles/index'; -import {ThemeColors} from '@styles/theme/types'; +import type {ThemeStyles} from '@styles/index'; +import type {ThemeColors} from '@styles/theme/types'; type StyleUtilGenerator> = (props: {theme: ThemeColors; styles: ThemeStyles}) => StyleUtil; diff --git a/src/styles/utils/getContextMenuItemStyles/index.native.ts b/src/styles/utils/getContextMenuItemStyles/index.native.ts index c8c1a828a0f3..cb0f55cd8d1d 100644 --- a/src/styles/utils/getContextMenuItemStyles/index.native.ts +++ b/src/styles/utils/getContextMenuItemStyles/index.native.ts @@ -1,4 +1,4 @@ -import GetContextMenuItemStyle from './types'; +import type GetContextMenuItemStyle from './types'; const getContextMenuItemStyles: GetContextMenuItemStyle = (styles) => [styles.popoverMenuItem]; diff --git a/src/styles/utils/getContextMenuItemStyles/index.ts b/src/styles/utils/getContextMenuItemStyles/index.ts index 42635033a244..b8c879c0bfdf 100644 --- a/src/styles/utils/getContextMenuItemStyles/index.ts +++ b/src/styles/utils/getContextMenuItemStyles/index.ts @@ -1,5 +1,5 @@ import variables from '@styles/variables'; -import GetContextMenuItemStyle from './types'; +import type GetContextMenuItemStyle from './types'; const getContextMenuItemStyles: GetContextMenuItemStyle = (styles, windowWidth) => { if (windowWidth && windowWidth > variables.mobileResponsiveWidthBreakpoint) { diff --git a/src/styles/utils/getContextMenuItemStyles/types.ts b/src/styles/utils/getContextMenuItemStyles/types.ts index 06b989becf8a..67668c36fcca 100644 --- a/src/styles/utils/getContextMenuItemStyles/types.ts +++ b/src/styles/utils/getContextMenuItemStyles/types.ts @@ -1,5 +1,5 @@ -import {ViewStyle} from 'react-native'; -import {type ThemeStyles} from '@styles/index'; +import type {ViewStyle} from 'react-native'; +import type {ThemeStyles} from '@styles/index'; type GetContextMenuItemStyle = (styles: ThemeStyles, windowWidth?: number) => ViewStyle[]; diff --git a/src/styles/utils/getNavigationModalCardStyles/index.desktop.ts b/src/styles/utils/getNavigationModalCardStyles/index.desktop.ts index 523f82048a02..c7a469cbd114 100644 --- a/src/styles/utils/getNavigationModalCardStyles/index.desktop.ts +++ b/src/styles/utils/getNavigationModalCardStyles/index.desktop.ts @@ -1,5 +1,5 @@ import positioning from '@styles/utils/positioning'; -import GetNavigationModalCardStyles from './types'; +import type GetNavigationModalCardStyles from './types'; const getNavigationModalCardStyles: GetNavigationModalCardStyles = () => ({ // position: fixed is set instead of position absolute to workaround Safari known issues of updating heights in DOM. diff --git a/src/styles/utils/getNavigationModalCardStyles/index.ts b/src/styles/utils/getNavigationModalCardStyles/index.ts index d3cf49c6c89c..1614690dbbcd 100644 --- a/src/styles/utils/getNavigationModalCardStyles/index.ts +++ b/src/styles/utils/getNavigationModalCardStyles/index.ts @@ -1,4 +1,4 @@ -import GetNavigationModalCardStyles from './types'; +import type GetNavigationModalCardStyles from './types'; const getNavigationModalCardStyles: GetNavigationModalCardStyles = () => ({ height: '100%', diff --git a/src/styles/utils/getNavigationModalCardStyles/index.website.ts b/src/styles/utils/getNavigationModalCardStyles/index.website.ts index 523f82048a02..c7a469cbd114 100644 --- a/src/styles/utils/getNavigationModalCardStyles/index.website.ts +++ b/src/styles/utils/getNavigationModalCardStyles/index.website.ts @@ -1,5 +1,5 @@ import positioning from '@styles/utils/positioning'; -import GetNavigationModalCardStyles from './types'; +import type GetNavigationModalCardStyles from './types'; const getNavigationModalCardStyles: GetNavigationModalCardStyles = () => ({ // position: fixed is set instead of position absolute to workaround Safari known issues of updating heights in DOM. diff --git a/src/styles/utils/getNavigationModalCardStyles/types.ts b/src/styles/utils/getNavigationModalCardStyles/types.ts index e0dba07dc908..77452bd77268 100644 --- a/src/styles/utils/getNavigationModalCardStyles/types.ts +++ b/src/styles/utils/getNavigationModalCardStyles/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type GetNavigationModalCardStyles = () => ViewStyle; diff --git a/src/styles/utils/getPopOverVerticalOffset/index.desktop.ts b/src/styles/utils/getPopOverVerticalOffset/index.desktop.ts index 3caab6057a4b..e9880dda42ab 100644 --- a/src/styles/utils/getPopOverVerticalOffset/index.desktop.ts +++ b/src/styles/utils/getPopOverVerticalOffset/index.desktop.ts @@ -1,5 +1,5 @@ import CONST from '@src/CONST'; -import GetPopOverVerticalOffset from './types'; +import type GetPopOverVerticalOffset from './types'; /** Adds the header padding with vertical offset on desktop */ const getPopOverVerticalOffset: GetPopOverVerticalOffset = (vertical) => ({ diff --git a/src/styles/utils/getPopOverVerticalOffset/index.ts b/src/styles/utils/getPopOverVerticalOffset/index.ts index 854653766cd2..a1b64c4f198f 100644 --- a/src/styles/utils/getPopOverVerticalOffset/index.ts +++ b/src/styles/utils/getPopOverVerticalOffset/index.ts @@ -1,4 +1,4 @@ -import GetPopOverVerticalOffset from './types'; +import type GetPopOverVerticalOffset from './types'; const getPopOverVerticalOffset: GetPopOverVerticalOffset = (vertical: number) => ({vertical}); diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 4d7af731bae8..b3b4924ebb19 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1,15 +1,17 @@ -import {Animated, DimensionValue, ImageStyle, PressableStateCallbackType, StyleProp, StyleSheet, TextStyle, ViewStyle} from 'react-native'; -import {EdgeInsets} from 'react-native-safe-area-context'; -import {ValueOf} from 'type-fest'; +import type {Animated, DimensionValue, ImageStyle, PressableStateCallbackType, StyleProp, TextStyle, ViewStyle} from 'react-native'; +import {StyleSheet} from 'react-native'; +import type {EdgeInsets} from 'react-native-safe-area-context'; +import type {ValueOf} from 'type-fest'; import * as Browser from '@libs/Browser'; import * as UserUtils from '@libs/UserUtils'; import {defaultTheme} from '@styles/theme'; import colors from '@styles/theme/colors'; -import {ThemeColors} from '@styles/theme/types'; +import type {ThemeColors} from '@styles/theme/types'; import variables from '@styles/variables'; import CONST from '@src/CONST'; -import {Transaction} from '@src/types/onyx'; -import {defaultStyles, type ThemeStyles} from '..'; +import type {Transaction} from '@src/types/onyx'; +import {defaultStyles} from '..'; +import type {ThemeStyles} from '..'; import containerComposeStyles from './containerComposeStyles'; import fontFamily from './fontFamily'; import createModalStyleUtils from './generators/ModalStyleUtils'; @@ -18,7 +20,7 @@ import createTooltipStyleUtils from './generators/TooltipStyleUtils'; import getContextMenuItemStyles from './getContextMenuItemStyles'; import {compactContentContainerStyles} from './optionRowStyles'; import positioning from './positioning'; -import { +import type { AllStyles, AvatarSize, AvatarSizeName, diff --git a/src/styles/utils/italic/index.android.ts b/src/styles/utils/italic/index.android.ts index bbd9deb8cf8d..96b825b1958c 100644 --- a/src/styles/utils/italic/index.android.ts +++ b/src/styles/utils/italic/index.android.ts @@ -1,4 +1,4 @@ -import ItalicStyles from './types'; +import type ItalicStyles from './types'; const italic: ItalicStyles = 'normal'; diff --git a/src/styles/utils/italic/index.ts b/src/styles/utils/italic/index.ts index 02d6c46423f6..7567100a380c 100644 --- a/src/styles/utils/italic/index.ts +++ b/src/styles/utils/italic/index.ts @@ -1,4 +1,4 @@ -import ItalicStyles from './types'; +import type ItalicStyles from './types'; const italic: ItalicStyles = 'italic'; diff --git a/src/styles/utils/italic/types.ts b/src/styles/utils/italic/types.ts index e9feedbdfac5..f8fada7edb0c 100644 --- a/src/styles/utils/italic/types.ts +++ b/src/styles/utils/italic/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type ItalicStyles = NonNullable; diff --git a/src/styles/utils/objectFit.ts b/src/styles/utils/objectFit.ts index 51f0c33b5457..2c748a69e87c 100644 --- a/src/styles/utils/objectFit.ts +++ b/src/styles/utils/objectFit.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; export default { oFCover: { diff --git a/src/styles/utils/optionAlternateTextPlatformStyles/index.ios.ts b/src/styles/utils/optionAlternateTextPlatformStyles/index.ios.ts index 14b024757fb8..160ef8be2f8d 100644 --- a/src/styles/utils/optionAlternateTextPlatformStyles/index.ios.ts +++ b/src/styles/utils/optionAlternateTextPlatformStyles/index.ios.ts @@ -1,4 +1,4 @@ -import OptionAlternateTextPlatformStyles from './types'; +import type OptionAlternateTextPlatformStyles from './types'; const optionAlternateTextPlatformStyles: OptionAlternateTextPlatformStyles = { paddingTop: 1, diff --git a/src/styles/utils/optionAlternateTextPlatformStyles/index.ts b/src/styles/utils/optionAlternateTextPlatformStyles/index.ts index e3232b810e06..00a967b5011e 100644 --- a/src/styles/utils/optionAlternateTextPlatformStyles/index.ts +++ b/src/styles/utils/optionAlternateTextPlatformStyles/index.ts @@ -1,4 +1,4 @@ -import OptionAlternateTextPlatformStyles from './types'; +import type OptionAlternateTextPlatformStyles from './types'; const optionAlternateTextPlatformStyles: OptionAlternateTextPlatformStyles = {}; diff --git a/src/styles/utils/optionAlternateTextPlatformStyles/types.ts b/src/styles/utils/optionAlternateTextPlatformStyles/types.ts index aacdef7e3501..8b37d963b214 100644 --- a/src/styles/utils/optionAlternateTextPlatformStyles/types.ts +++ b/src/styles/utils/optionAlternateTextPlatformStyles/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type OptionAlternateTextPlatformStyles = Pick; diff --git a/src/styles/utils/optionRowStyles/index.native.ts b/src/styles/utils/optionRowStyles/index.native.ts index 334017ba3374..d41e34f23304 100644 --- a/src/styles/utils/optionRowStyles/index.native.ts +++ b/src/styles/utils/optionRowStyles/index.native.ts @@ -1,4 +1,4 @@ -import CompactContentContainerStyles from './types'; +import type CompactContentContainerStyles from './types'; /** * On native platforms, alignItemsBaseline does not work correctly diff --git a/src/styles/utils/optionRowStyles/index.ts b/src/styles/utils/optionRowStyles/index.ts index ce8f542a13ca..b7f40a760cdf 100644 --- a/src/styles/utils/optionRowStyles/index.ts +++ b/src/styles/utils/optionRowStyles/index.ts @@ -1,4 +1,4 @@ -import CompactContentContainerStyles from './types'; +import type CompactContentContainerStyles from './types'; const compactContentContainerStyles: CompactContentContainerStyles = (styles) => styles.alignItemsBaseline; diff --git a/src/styles/utils/optionRowStyles/types.ts b/src/styles/utils/optionRowStyles/types.ts index a31b94e0fc79..5ba49b9a02a2 100644 --- a/src/styles/utils/optionRowStyles/types.ts +++ b/src/styles/utils/optionRowStyles/types.ts @@ -1,5 +1,5 @@ -import {ViewStyle} from 'react-native'; -import {type ThemeStyles} from '@styles/index'; +import type {ViewStyle} from 'react-native'; +import type {ThemeStyles} from '@styles/index'; type CompactContentContainerStyles = (styles: ThemeStyles) => ViewStyle; diff --git a/src/styles/utils/overflow.ts b/src/styles/utils/overflow.ts index 9b4fa010af84..74d1dd96f852 100644 --- a/src/styles/utils/overflow.ts +++ b/src/styles/utils/overflow.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; import overflowAuto from './overflowAuto'; import overscrollBehaviorContain from './overscrollBehaviorContain'; diff --git a/src/styles/utils/overflowAuto/index.native.ts b/src/styles/utils/overflowAuto/index.native.ts index 34ee18db1d0a..7db324a39c8f 100644 --- a/src/styles/utils/overflowAuto/index.native.ts +++ b/src/styles/utils/overflowAuto/index.native.ts @@ -1,4 +1,4 @@ -import OverflowAutoStyles from './types'; +import type OverflowAutoStyles from './types'; // Overflow auto doesn't exist in react-native so we'll default to overflow: visible const overflowAuto: OverflowAutoStyles = { diff --git a/src/styles/utils/overflowAuto/index.ts b/src/styles/utils/overflowAuto/index.ts index 1e7ac8ed8246..670a0b9643eb 100644 --- a/src/styles/utils/overflowAuto/index.ts +++ b/src/styles/utils/overflowAuto/index.ts @@ -1,5 +1,5 @@ -import {ViewStyle} from 'react-native'; -import OverflowAutoStyles from './types'; +import type {ViewStyle} from 'react-native'; +import type OverflowAutoStyles from './types'; /** * Web-only style. diff --git a/src/styles/utils/overflowAuto/types.ts b/src/styles/utils/overflowAuto/types.ts index da7548d49e7b..e91d5ce7d2c3 100644 --- a/src/styles/utils/overflowAuto/types.ts +++ b/src/styles/utils/overflowAuto/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type OverflowAutoStyles = Pick; diff --git a/src/styles/utils/overflowXHidden/index.native.ts b/src/styles/utils/overflowXHidden/index.native.ts index 3a2f61893d94..5455893d452c 100644 --- a/src/styles/utils/overflowXHidden/index.native.ts +++ b/src/styles/utils/overflowXHidden/index.native.ts @@ -1,4 +1,4 @@ -import OverflowXHiddenStyles from './types'; +import type OverflowXHiddenStyles from './types'; const overflowXHidden: OverflowXHiddenStyles = {}; diff --git a/src/styles/utils/overflowXHidden/index.ts b/src/styles/utils/overflowXHidden/index.ts index 6807be275be9..e83e0c824f9a 100644 --- a/src/styles/utils/overflowXHidden/index.ts +++ b/src/styles/utils/overflowXHidden/index.ts @@ -1,4 +1,4 @@ -import OverflowXHiddenStyles from './types'; +import type OverflowXHiddenStyles from './types'; const overflowXHidden: OverflowXHiddenStyles = { overflowX: 'hidden', diff --git a/src/styles/utils/overflowXHidden/types.ts b/src/styles/utils/overflowXHidden/types.ts index 0f13ba552c0c..fb01fc68cb96 100644 --- a/src/styles/utils/overflowXHidden/types.ts +++ b/src/styles/utils/overflowXHidden/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type OverflowXHiddenStyles = Pick; diff --git a/src/styles/utils/overscrollBehaviorContain/index.native.ts b/src/styles/utils/overscrollBehaviorContain/index.native.ts index fd6b2f496912..a48b97807ba0 100644 --- a/src/styles/utils/overscrollBehaviorContain/index.native.ts +++ b/src/styles/utils/overscrollBehaviorContain/index.native.ts @@ -1,4 +1,4 @@ -import OverscrollBehaviorStyles from './types'; +import type OverscrollBehaviorStyles from './types'; const overscrollBehaviorContain: OverscrollBehaviorStyles = {}; diff --git a/src/styles/utils/overscrollBehaviorContain/index.ts b/src/styles/utils/overscrollBehaviorContain/index.ts index 18cbe810d336..86d3882824d8 100644 --- a/src/styles/utils/overscrollBehaviorContain/index.ts +++ b/src/styles/utils/overscrollBehaviorContain/index.ts @@ -1,4 +1,4 @@ -import OverscrollBehaviorStyles from './types'; +import type OverscrollBehaviorStyles from './types'; const overscrollBehaviorContain: OverscrollBehaviorStyles = { overscrollBehavior: 'contain', diff --git a/src/styles/utils/overscrollBehaviorContain/types.ts b/src/styles/utils/overscrollBehaviorContain/types.ts index 1e806eb60642..b608972b892b 100644 --- a/src/styles/utils/overscrollBehaviorContain/types.ts +++ b/src/styles/utils/overscrollBehaviorContain/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type OverscrollBehaviorStyles = Pick; diff --git a/src/styles/utils/pointerEventsAuto/index.native.ts b/src/styles/utils/pointerEventsAuto/index.native.ts index cbefa643d1e0..5b53c54d28f5 100644 --- a/src/styles/utils/pointerEventsAuto/index.native.ts +++ b/src/styles/utils/pointerEventsAuto/index.native.ts @@ -1,4 +1,4 @@ -import PointerEventsAutoStyles from './types'; +import type PointerEventsAutoStyles from './types'; const pointerEventsAuto: PointerEventsAutoStyles = {}; diff --git a/src/styles/utils/pointerEventsAuto/index.ts b/src/styles/utils/pointerEventsAuto/index.ts index 8abda90caafe..f7ba29ef5fbb 100644 --- a/src/styles/utils/pointerEventsAuto/index.ts +++ b/src/styles/utils/pointerEventsAuto/index.ts @@ -1,4 +1,4 @@ -import PointerEventsAutoStyles from './types'; +import type PointerEventsAutoStyles from './types'; const pointerEventsAuto: PointerEventsAutoStyles = { pointerEvents: 'auto', diff --git a/src/styles/utils/pointerEventsAuto/types.ts b/src/styles/utils/pointerEventsAuto/types.ts index 0ecbc851e000..253d892aacf8 100644 --- a/src/styles/utils/pointerEventsAuto/types.ts +++ b/src/styles/utils/pointerEventsAuto/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type PointerEventsAutoStyles = Pick; diff --git a/src/styles/utils/pointerEventsBoxNone/index.native.ts b/src/styles/utils/pointerEventsBoxNone/index.native.ts index 05ad2c07db39..0b59172395a1 100644 --- a/src/styles/utils/pointerEventsBoxNone/index.native.ts +++ b/src/styles/utils/pointerEventsBoxNone/index.native.ts @@ -1,4 +1,4 @@ -import PointerEventsBoxNone from './types'; +import type PointerEventsBoxNone from './types'; const pointerEventsBoxNone: PointerEventsBoxNone = {}; diff --git a/src/styles/utils/pointerEventsBoxNone/index.ts b/src/styles/utils/pointerEventsBoxNone/index.ts index 0e63e2deda09..4aa0972424b2 100644 --- a/src/styles/utils/pointerEventsBoxNone/index.ts +++ b/src/styles/utils/pointerEventsBoxNone/index.ts @@ -1,4 +1,4 @@ -import PointerEventsBoxNone from './types'; +import type PointerEventsBoxNone from './types'; const pointerEventsNone: PointerEventsBoxNone = { pointerEvents: 'box-none', diff --git a/src/styles/utils/pointerEventsBoxNone/types.ts b/src/styles/utils/pointerEventsBoxNone/types.ts index 25e85812f4e0..05c686640b3a 100644 --- a/src/styles/utils/pointerEventsBoxNone/types.ts +++ b/src/styles/utils/pointerEventsBoxNone/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type PointerEventsBoxNone = Pick; diff --git a/src/styles/utils/pointerEventsNone/index.native.ts b/src/styles/utils/pointerEventsNone/index.native.ts index d92936025c94..1503fd9f68f0 100644 --- a/src/styles/utils/pointerEventsNone/index.native.ts +++ b/src/styles/utils/pointerEventsNone/index.native.ts @@ -1,4 +1,4 @@ -import PointerEventsNone from './types'; +import type PointerEventsNone from './types'; const pointerEventsNone: PointerEventsNone = {}; diff --git a/src/styles/utils/pointerEventsNone/index.ts b/src/styles/utils/pointerEventsNone/index.ts index 20dc46412e6d..fe535ad5e54b 100644 --- a/src/styles/utils/pointerEventsNone/index.ts +++ b/src/styles/utils/pointerEventsNone/index.ts @@ -1,4 +1,4 @@ -import PointerEventsNone from './types'; +import type PointerEventsNone from './types'; const pointerEventsNone: PointerEventsNone = { pointerEvents: 'none', diff --git a/src/styles/utils/pointerEventsNone/types.ts b/src/styles/utils/pointerEventsNone/types.ts index 766ac3f94349..34c31873df5b 100644 --- a/src/styles/utils/pointerEventsNone/types.ts +++ b/src/styles/utils/pointerEventsNone/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type PointerEventsNone = Pick; diff --git a/src/styles/utils/positioning.ts b/src/styles/utils/positioning.ts index 26e6198a5827..5e0169990499 100644 --- a/src/styles/utils/positioning.ts +++ b/src/styles/utils/positioning.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; /** * Positioning utilities for absolute-positioned components. diff --git a/src/styles/utils/sizing.ts b/src/styles/utils/sizing.ts index 212d532c1b23..e7273f7b2b18 100644 --- a/src/styles/utils/sizing.ts +++ b/src/styles/utils/sizing.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; /** * Sizing utility styles with Bootstrap inspired naming. diff --git a/src/styles/utils/spacing.ts b/src/styles/utils/spacing.ts index b2597fc64603..6def4858229f 100644 --- a/src/styles/utils/spacing.ts +++ b/src/styles/utils/spacing.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; /** * Spacing utility styles with Bootstrap inspired naming. @@ -223,6 +223,10 @@ export default { marginTop: 'auto', }, + mtn2: { + marginTop: -8, + }, + mtn6: { marginTop: -24, }, diff --git a/src/styles/utils/textDecorationLine.ts b/src/styles/utils/textDecorationLine.ts index 02e7db41e10a..e5f079150e78 100644 --- a/src/styles/utils/textDecorationLine.ts +++ b/src/styles/utils/textDecorationLine.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; export default { lineThrough: { diff --git a/src/styles/utils/textUnderline/index.native.ts b/src/styles/utils/textUnderline/index.native.ts index b3acbb48d01c..c658b2a3df86 100644 --- a/src/styles/utils/textUnderline/index.native.ts +++ b/src/styles/utils/textUnderline/index.native.ts @@ -1,4 +1,4 @@ -import TextUnderlineStyles from './types'; +import type TextUnderlineStyles from './types'; // following styles are not supported const textUnderline: TextUnderlineStyles = { diff --git a/src/styles/utils/textUnderline/index.ts b/src/styles/utils/textUnderline/index.ts index 2fbf6e0e354c..0dd06f004306 100644 --- a/src/styles/utils/textUnderline/index.ts +++ b/src/styles/utils/textUnderline/index.ts @@ -1,4 +1,4 @@ -import TextUnderlineStyles from './types'; +import type TextUnderlineStyles from './types'; const textUnderline: TextUnderlineStyles = { textUnderlinePositionUnder: { diff --git a/src/styles/utils/textUnderline/types.ts b/src/styles/utils/textUnderline/types.ts index f71d2bfdaa9a..0b103a0fb98e 100644 --- a/src/styles/utils/textUnderline/types.ts +++ b/src/styles/utils/textUnderline/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type TextUnderlineStyles = { textUnderlinePositionUnder: Pick; diff --git a/src/styles/utils/types.ts b/src/styles/utils/types.ts index 40a261beee71..5fe844f0f358 100644 --- a/src/styles/utils/types.ts +++ b/src/styles/utils/types.ts @@ -1,5 +1,5 @@ -import {ImageStyle, PressableStateCallbackType, StyleProp, TextStyle, ViewStyle} from 'react-native'; -import {ValueOf} from 'type-fest'; +import type {ImageStyle, PressableStateCallbackType, StyleProp, TextStyle, ViewStyle} from 'react-native'; +import type {ValueOf} from 'type-fest'; import type colors from '@styles/theme/colors'; import type variables from '@styles/variables'; import type CONST from '@src/CONST'; diff --git a/src/styles/utils/userSelect/index.native.ts b/src/styles/utils/userSelect/index.native.ts index 0d1a34ef2473..05e3c8996f4a 100644 --- a/src/styles/utils/userSelect/index.native.ts +++ b/src/styles/utils/userSelect/index.native.ts @@ -1,4 +1,4 @@ -import UserSelectStyles from './types'; +import type UserSelectStyles from './types'; const userSelect: UserSelectStyles = { userSelectText: { diff --git a/src/styles/utils/userSelect/index.ts b/src/styles/utils/userSelect/index.ts index 6b9f26131b5e..79eec6d3b139 100644 --- a/src/styles/utils/userSelect/index.ts +++ b/src/styles/utils/userSelect/index.ts @@ -1,4 +1,4 @@ -import UserSelectStyles from './types'; +import type UserSelectStyles from './types'; const userSelect: UserSelectStyles = { userSelectText: { diff --git a/src/styles/utils/userSelect/types.ts b/src/styles/utils/userSelect/types.ts index a177bac5a3e7..74a4a7bbde9a 100644 --- a/src/styles/utils/userSelect/types.ts +++ b/src/styles/utils/userSelect/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type UserSelectStyles = Record<'userSelectText' | 'userSelectNone', Pick>; diff --git a/src/styles/utils/visibility/index.native.ts b/src/styles/utils/visibility/index.native.ts index c74719d02184..79ea2f345cf6 100644 --- a/src/styles/utils/visibility/index.native.ts +++ b/src/styles/utils/visibility/index.native.ts @@ -1,4 +1,4 @@ -import VisibilityStyles from './types'; +import type VisibilityStyles from './types'; const visibility: VisibilityStyles = { visible: {}, diff --git a/src/styles/utils/visibility/index.ts b/src/styles/utils/visibility/index.ts index 8e2d3451be43..f0743a481647 100644 --- a/src/styles/utils/visibility/index.ts +++ b/src/styles/utils/visibility/index.ts @@ -1,4 +1,4 @@ -import VisibilityStyles from './types'; +import type VisibilityStyles from './types'; const visibility: VisibilityStyles = { visible: { diff --git a/src/styles/utils/visibility/types.ts b/src/styles/utils/visibility/types.ts index 64bdbdd2cca6..93761babeade 100644 --- a/src/styles/utils/visibility/types.ts +++ b/src/styles/utils/visibility/types.ts @@ -1,4 +1,4 @@ -import {ViewStyle} from 'react-native'; +import type {ViewStyle} from 'react-native'; type VisibilityStyles = Record<'visible' | 'hidden', Pick>; diff --git a/src/styles/utils/whiteSpace/index.native.ts b/src/styles/utils/whiteSpace/index.native.ts index 420bda325c6a..cf02b0e9ff42 100644 --- a/src/styles/utils/whiteSpace/index.native.ts +++ b/src/styles/utils/whiteSpace/index.native.ts @@ -1,4 +1,4 @@ -import WhiteSpaceStyles from './types'; +import type WhiteSpaceStyles from './types'; const whiteSpace: WhiteSpaceStyles = { noWrap: {}, diff --git a/src/styles/utils/whiteSpace/index.ts b/src/styles/utils/whiteSpace/index.ts index dd0ef94d12b0..ad736d233fdb 100644 --- a/src/styles/utils/whiteSpace/index.ts +++ b/src/styles/utils/whiteSpace/index.ts @@ -1,4 +1,4 @@ -import WhiteSpaceStyles from './types'; +import type WhiteSpaceStyles from './types'; const whiteSpace: WhiteSpaceStyles = { noWrap: { diff --git a/src/styles/utils/whiteSpace/types.ts b/src/styles/utils/whiteSpace/types.ts index b10671f04977..5fa98ad506d0 100644 --- a/src/styles/utils/whiteSpace/types.ts +++ b/src/styles/utils/whiteSpace/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type WhiteSpaceStyles = Record<'noWrap' | 'preWrap' | 'pre', Pick>; diff --git a/src/styles/utils/wordBreak/index.native.ts b/src/styles/utils/wordBreak/index.native.ts index c4575c51d3f2..0afdda99d0d9 100644 --- a/src/styles/utils/wordBreak/index.native.ts +++ b/src/styles/utils/wordBreak/index.native.ts @@ -1,4 +1,4 @@ -import WordBreakStyles from './types'; +import type WordBreakStyles from './types'; const wordBreak: WordBreakStyles = { breakWord: {}, diff --git a/src/styles/utils/wordBreak/index.ts b/src/styles/utils/wordBreak/index.ts index 4da23e0f074a..b224fe472181 100644 --- a/src/styles/utils/wordBreak/index.ts +++ b/src/styles/utils/wordBreak/index.ts @@ -1,4 +1,4 @@ -import WordBreakStyles from './types'; +import type WordBreakStyles from './types'; const wordBreak: WordBreakStyles = { breakWord: { diff --git a/src/styles/utils/wordBreak/types.ts b/src/styles/utils/wordBreak/types.ts index 0ed520ae119d..2e81d1aac449 100644 --- a/src/styles/utils/wordBreak/types.ts +++ b/src/styles/utils/wordBreak/types.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; type WordBreakStyles = Record<'breakWord' | 'breakAll', Pick>; diff --git a/src/styles/utils/writingDirection.ts b/src/styles/utils/writingDirection.ts index f3f249796047..e385e8bd9a6d 100644 --- a/src/styles/utils/writingDirection.ts +++ b/src/styles/utils/writingDirection.ts @@ -1,4 +1,4 @@ -import {TextStyle} from 'react-native'; +import type {TextStyle} from 'react-native'; /** * Writing direction utility styles. diff --git a/src/types/global.d.ts b/src/types/global.d.ts index d220f33889d2..a3326ed4d008 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -1,24 +1,28 @@ declare module '*.png' { - const value: import('react-native').ImageSourcePropType; + import type {ImageSourcePropType} from 'react-native'; + + const value: ImageSourcePropType; export default value; } declare module '*.jpg' { - const value: import('react-native').ImageSourcePropType; + import type {ImageSourcePropType} from 'react-native'; + + const value: ImageSourcePropType; export default value; } declare module '*.svg' { - import React from 'react'; - import {SvgProps} from 'react-native-svg'; + import type React from 'react'; + import type {SvgProps} from 'react-native-svg'; - const content: React.FC | import('react-native').ImageSourcePropType; + const content: React.FC; export default content; } declare module '*.lottie' { - const value: import('lottie-react-native').LottieViewProps.source; + import type {LottieViewProps} from 'lottie-react-native'; + + const value: LottieViewProps['source']; export default value; } - -declare module 'react-native-device-info/jest/react-native-device-info-mock'; diff --git a/src/types/modules/pusher.d.ts b/src/types/modules/pusher.d.ts index 9705ec4935c8..676d7a7ee2fc 100644 --- a/src/types/modules/pusher.d.ts +++ b/src/types/modules/pusher.d.ts @@ -1,4 +1,4 @@ -import Pusher from 'pusher-js/types/src/core/pusher'; +import type Pusher from 'pusher-js/types/src/core/pusher'; declare global { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions diff --git a/src/types/modules/react-native-onyx.d.ts b/src/types/modules/react-native-onyx.d.ts index d603b9f93ae8..05302577910b 100644 --- a/src/types/modules/react-native-onyx.d.ts +++ b/src/types/modules/react-native-onyx.d.ts @@ -1,4 +1,4 @@ -import {OnyxCollectionKey, OnyxKey, OnyxValues} from '@src/ONYXKEYS'; +import type {OnyxCollectionKey, OnyxKey, OnyxValues} from '@src/ONYXKEYS'; declare module 'react-native-onyx' { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions diff --git a/src/types/modules/react-native-svg.d.ts b/src/types/modules/react-native-svg.d.ts index 4adc164fa853..0d98870b04b2 100644 --- a/src/types/modules/react-native-svg.d.ts +++ b/src/types/modules/react-native-svg.d.ts @@ -1,4 +1,4 @@ -import {CommonPathProps as BaseCommonPathProps, SvgProps as BaseSvgProps} from 'react-native-svg'; +import type {CommonPathProps as BaseCommonPathProps, SvgProps as BaseSvgProps} from 'react-native-svg'; declare module 'react-native-svg' { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions diff --git a/src/types/modules/react-native.d.ts b/src/types/modules/react-native.d.ts index 25ff1c6c73b8..8175a3631354 100644 --- a/src/types/modules/react-native.d.ts +++ b/src/types/modules/react-native.d.ts @@ -4,9 +4,9 @@ /* eslint-disable @typescript-eslint/consistent-type-definitions */ // eslint-disable-next-line no-restricted-imports -import {CSSProperties, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, PointerEventHandler, UIEventHandler, WheelEventHandler} from 'react'; +import type {CSSProperties, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, PointerEventHandler, UIEventHandler, WheelEventHandler} from 'react'; import 'react-native'; -import {BootSplashModule} from '@libs/BootSplash/types'; +import type {BootSplashModule} from '@libs/BootSplash/types'; declare module 'react-native' { // <------ REACT NATIVE WEB (0.19.0) ------> diff --git a/src/types/modules/react-navigation.d.ts b/src/types/modules/react-navigation.d.ts index 1ac35c937116..f6a47f3cdb9a 100644 --- a/src/types/modules/react-navigation.d.ts +++ b/src/types/modules/react-navigation.d.ts @@ -1,4 +1,4 @@ -import {RootStackParamList} from '@libs/Navigation/types'; +import type {RootStackParamList} from '@libs/Navigation/types'; declare global { namespace ReactNavigation { diff --git a/src/types/modules/react.d.ts b/src/types/modules/react.d.ts index 0608a59b4702..3e2e8fb37aa8 100644 --- a/src/types/modules/react.d.ts +++ b/src/types/modules/react.d.ts @@ -1,4 +1,4 @@ -import React from 'react'; +import type React from 'react'; declare module 'react' { // eslint-disable-next-line @typescript-eslint/ban-types diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts index 8093642a7111..0ea3e05e8d6a 100644 --- a/src/types/onyx/Account.ts +++ b/src/types/onyx/Account.ts @@ -1,6 +1,6 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import * as OnyxCommon from './OnyxCommon'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type * as OnyxCommon from './OnyxCommon'; type TwoFactorAuthStep = ValueOf | ''; diff --git a/src/types/onyx/AccountData.ts b/src/types/onyx/AccountData.ts index 601e82cde836..88511eec6864 100644 --- a/src/types/onyx/AccountData.ts +++ b/src/types/onyx/AccountData.ts @@ -1,5 +1,5 @@ -import {BankName} from './Bank'; -import * as OnyxCommon from './OnyxCommon'; +import type {BankName} from './Bank'; +import type * as OnyxCommon from './OnyxCommon'; type AdditionalData = { isP2PDebitCard?: boolean; diff --git a/src/types/onyx/Bank.ts b/src/types/onyx/Bank.ts index 533458c88b49..72b5fcda4788 100644 --- a/src/types/onyx/Bank.ts +++ b/src/types/onyx/Bank.ts @@ -1,7 +1,7 @@ -import {ViewStyle} from 'react-native'; -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import IconAsset from '@src/types/utils/IconAsset'; +import type {ViewStyle} from 'react-native'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type IconAsset from '@src/types/utils/IconAsset'; type BankIcon = { icon: IconAsset; diff --git a/src/types/onyx/BankAccount.ts b/src/types/onyx/BankAccount.ts index 8e26faf518cb..b9d541b72f2e 100644 --- a/src/types/onyx/BankAccount.ts +++ b/src/types/onyx/BankAccount.ts @@ -1,6 +1,6 @@ -import CONST from '@src/CONST'; -import AccountData from './AccountData'; -import * as OnyxCommon from './OnyxCommon'; +import type CONST from '@src/CONST'; +import type AccountData from './AccountData'; +import type * as OnyxCommon from './OnyxCommon'; type AdditionalData = { isP2PDebitCard?: boolean; diff --git a/src/types/onyx/Beta.ts b/src/types/onyx/Beta.ts index 9216946499e8..35ed4c804ab8 100644 --- a/src/types/onyx/Beta.ts +++ b/src/types/onyx/Beta.ts @@ -1,5 +1,5 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; type Beta = ValueOf; diff --git a/src/types/onyx/Card.ts b/src/types/onyx/Card.ts index ae4e86212a00..e3b025ff5a2f 100644 --- a/src/types/onyx/Card.ts +++ b/src/types/onyx/Card.ts @@ -1,6 +1,6 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import * as OnyxCommon from './OnyxCommon'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type * as OnyxCommon from './OnyxCommon'; type Card = { cardID: number; diff --git a/src/types/onyx/Form.ts b/src/types/onyx/Form.ts index 7b7d8d76536a..ca8d6574adf5 100644 --- a/src/types/onyx/Form.ts +++ b/src/types/onyx/Form.ts @@ -1,4 +1,4 @@ -import * as OnyxCommon from './OnyxCommon'; +import type * as OnyxCommon from './OnyxCommon'; type Form = { /** Controls the loading state of the form */ diff --git a/src/types/onyx/Fund.ts b/src/types/onyx/Fund.ts index e889a414062e..842a882ff23f 100644 --- a/src/types/onyx/Fund.ts +++ b/src/types/onyx/Fund.ts @@ -1,6 +1,6 @@ -import CONST from '@src/CONST'; -import {BankName} from './Bank'; -import * as OnyxCommon from './OnyxCommon'; +import type CONST from '@src/CONST'; +import type {BankName} from './Bank'; +import type * as OnyxCommon from './OnyxCommon'; type AdditionalData = { isBillingCard?: boolean; diff --git a/src/types/onyx/Locale.ts b/src/types/onyx/Locale.ts index 1a5124684995..89d7636009d7 100644 --- a/src/types/onyx/Locale.ts +++ b/src/types/onyx/Locale.ts @@ -1,5 +1,5 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; type Locale = ValueOf; diff --git a/src/types/onyx/Login.ts b/src/types/onyx/Login.ts index bcf949eb95e6..7a4093d4ab11 100644 --- a/src/types/onyx/Login.ts +++ b/src/types/onyx/Login.ts @@ -1,4 +1,4 @@ -import * as OnyxCommon from './OnyxCommon'; +import type * as OnyxCommon from './OnyxCommon'; type Login = { /** Phone/Email associated with user */ diff --git a/src/types/onyx/OnyxCommon.ts b/src/types/onyx/OnyxCommon.ts index 956e9ff36b24..b26dc167ed44 100644 --- a/src/types/onyx/OnyxCommon.ts +++ b/src/types/onyx/OnyxCommon.ts @@ -1,6 +1,6 @@ -import {ValueOf} from 'type-fest'; -import {AvatarSource} from '@libs/UserUtils'; -import CONST from '@src/CONST'; +import type {ValueOf} from 'type-fest'; +import type {AvatarSource} from '@libs/UserUtils'; +import type CONST from '@src/CONST'; type PendingAction = ValueOf; diff --git a/src/types/onyx/OnyxUpdatesFromServer.ts b/src/types/onyx/OnyxUpdatesFromServer.ts index 843d3ae86e46..b3932bbb7841 100644 --- a/src/types/onyx/OnyxUpdatesFromServer.ts +++ b/src/types/onyx/OnyxUpdatesFromServer.ts @@ -1,6 +1,6 @@ -import {OnyxUpdate} from 'react-native-onyx'; -import Request from './Request'; -import Response from './Response'; +import type {OnyxUpdate} from 'react-native-onyx'; +import type Request from './Request'; +import type Response from './Response'; type OnyxServerUpdate = OnyxUpdate & {shouldNotify?: boolean}; diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 767f724dd571..c4e30157bf6f 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -1,6 +1,6 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import DeepValueOf from '@src/types/utils/DeepValueOf'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type DeepValueOf from '@src/types/utils/DeepValueOf'; type ActionName = DeepValueOf; type OriginalMessageActionName = diff --git a/src/types/onyx/PaymentMethod.ts b/src/types/onyx/PaymentMethod.ts index c9645e01983b..4b3a4c8986fb 100644 --- a/src/types/onyx/PaymentMethod.ts +++ b/src/types/onyx/PaymentMethod.ts @@ -1,7 +1,7 @@ -import {ViewStyle} from 'react-native'; -import IconAsset from '@src/types/utils/IconAsset'; -import BankAccount from './BankAccount'; -import Fund from './Fund'; +import type {ViewStyle} from 'react-native'; +import type IconAsset from '@src/types/utils/IconAsset'; +import type BankAccount from './BankAccount'; +import type Fund from './Fund'; type PaymentMethod = (BankAccount | Fund) & { description: string; diff --git a/src/types/onyx/PersonalBankAccount.ts b/src/types/onyx/PersonalBankAccount.ts index 865f41bebbeb..8eb6d327f13c 100644 --- a/src/types/onyx/PersonalBankAccount.ts +++ b/src/types/onyx/PersonalBankAccount.ts @@ -1,4 +1,4 @@ -import * as OnyxCommon from './OnyxCommon'; +import type * as OnyxCommon from './OnyxCommon'; type PersonalBankAccount = { /** An error message to display to the user */ diff --git a/src/types/onyx/PersonalDetails.ts b/src/types/onyx/PersonalDetails.ts index 03aa7e4ec928..baf3b9d3801a 100644 --- a/src/types/onyx/PersonalDetails.ts +++ b/src/types/onyx/PersonalDetails.ts @@ -1,6 +1,6 @@ -import {AvatarSource} from '@libs/UserUtils'; -import TIMEZONES from '@src/TIMEZONES'; -import * as OnyxCommon from './OnyxCommon'; +import type {AvatarSource} from '@libs/UserUtils'; +import type TIMEZONES from '@src/TIMEZONES'; +import type * as OnyxCommon from './OnyxCommon'; type SelectedTimezone = (typeof TIMEZONES)[number]; diff --git a/src/types/onyx/PlaidData.ts b/src/types/onyx/PlaidData.ts index 28a1cb324bcb..8ec93119cbd8 100644 --- a/src/types/onyx/PlaidData.ts +++ b/src/types/onyx/PlaidData.ts @@ -1,5 +1,5 @@ -import * as OnyxCommon from './OnyxCommon'; -import PlaidBankAccount from './PlaidBankAccount'; +import type * as OnyxCommon from './OnyxCommon'; +import type PlaidBankAccount from './PlaidBankAccount'; type PlaidData = { /** Name of the bank */ diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 685fcd5e05d5..ff3a5e1dd23c 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -1,6 +1,6 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import * as OnyxCommon from './OnyxCommon'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type * as OnyxCommon from './OnyxCommon'; type Unit = 'mi' | 'km'; diff --git a/src/types/onyx/PolicyCategory.ts b/src/types/onyx/PolicyCategory.ts index b6dfb7bbab9a..03d5877bc5b5 100644 --- a/src/types/onyx/PolicyCategory.ts +++ b/src/types/onyx/PolicyCategory.ts @@ -20,5 +20,5 @@ type PolicyCategory = { }; type PolicyCategories = Record; -export default PolicyCategory; -export type {PolicyCategories}; + +export type {PolicyCategory, PolicyCategories}; diff --git a/src/types/onyx/PolicyMember.ts b/src/types/onyx/PolicyMember.ts index 60836b276ea0..6439888b9144 100644 --- a/src/types/onyx/PolicyMember.ts +++ b/src/types/onyx/PolicyMember.ts @@ -1,4 +1,4 @@ -import * as OnyxCommon from './OnyxCommon'; +import type * as OnyxCommon from './OnyxCommon'; type PolicyMember = { /** Role of the user in the policy */ diff --git a/src/types/onyx/PolicyTag.ts b/src/types/onyx/PolicyTag.ts index 7807dcc00433..58a21dcf4df5 100644 --- a/src/types/onyx/PolicyTag.ts +++ b/src/types/onyx/PolicyTag.ts @@ -12,5 +12,4 @@ type PolicyTag = { type PolicyTags = Record; -export default PolicyTag; -export type {PolicyTags}; +export type {PolicyTag, PolicyTags}; diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index 75954983371e..c0ade25e4d79 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -1,6 +1,6 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import * as OnyxCommon from './OnyxCommon'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type * as OnyxCommon from './OnyxCommon'; type BankAccountStep = ValueOf; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index b274025908f5..840bbd1e2e2f 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -1,7 +1,7 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import * as OnyxCommon from './OnyxCommon'; -import PersonalDetails from './PersonalDetails'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type * as OnyxCommon from './OnyxCommon'; +import type PersonalDetails from './PersonalDetails'; type NotificationPreference = ValueOf; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index a881b63fbb95..b727bc40ce93 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -1,11 +1,12 @@ -import {ValueOf} from 'type-fest'; -import {AvatarSource} from '@libs/UserUtils'; -import CONST from '@src/CONST'; -import {EmptyObject} from '@src/types/utils/EmptyObject'; -import * as OnyxCommon from './OnyxCommon'; -import OriginalMessage, {Decision, Reaction} from './OriginalMessage'; -import {NotificationPreference} from './Report'; -import {Receipt} from './Transaction'; +import type {ValueOf} from 'type-fest'; +import type {AvatarSource} from '@libs/UserUtils'; +import type CONST from '@src/CONST'; +import type {EmptyObject} from '@src/types/utils/EmptyObject'; +import type * as OnyxCommon from './OnyxCommon'; +import type {Decision, Reaction} from './OriginalMessage'; +import type OriginalMessage from './OriginalMessage'; +import type {NotificationPreference} from './Report'; +import type {Receipt} from './Transaction'; type Message = { /** The type of the action item fragment. Used to render a corresponding component */ diff --git a/src/types/onyx/ReportActionReactions.ts b/src/types/onyx/ReportActionReactions.ts index 348a4b1baf62..be117aafc4c5 100644 --- a/src/types/onyx/ReportActionReactions.ts +++ b/src/types/onyx/ReportActionReactions.ts @@ -1,4 +1,4 @@ -import * as OnyxCommon from './OnyxCommon'; +import type * as OnyxCommon from './OnyxCommon'; type UserReaction = { /** ID of user reaction */ diff --git a/src/types/onyx/ReportActionsDrafts.ts b/src/types/onyx/ReportActionsDrafts.ts index ad2782111144..70d16c62a3bc 100644 --- a/src/types/onyx/ReportActionsDrafts.ts +++ b/src/types/onyx/ReportActionsDrafts.ts @@ -1,4 +1,4 @@ -import ReportActionsDraft from './ReportActionsDraft'; +import type ReportActionsDraft from './ReportActionsDraft'; type ReportActionsDrafts = Record; diff --git a/src/types/onyx/Request.ts b/src/types/onyx/Request.ts index 746e7f75b3d5..fa87e1d194c2 100644 --- a/src/types/onyx/Request.ts +++ b/src/types/onyx/Request.ts @@ -1,5 +1,5 @@ -import {OnyxUpdate} from 'react-native-onyx'; -import Response from './Response'; +import type {OnyxUpdate} from 'react-native-onyx'; +import type Response from './Response'; type OnyxData = { successData?: OnyxUpdate[]; diff --git a/src/types/onyx/Response.ts b/src/types/onyx/Response.ts index 66d5dcbdfd5b..b06ec9766842 100644 --- a/src/types/onyx/Response.ts +++ b/src/types/onyx/Response.ts @@ -1,4 +1,4 @@ -import {OnyxUpdate} from 'react-native-onyx'; +import type {OnyxUpdate} from 'react-native-onyx'; type Data = { phpCommandName: string; diff --git a/src/types/onyx/Session.ts b/src/types/onyx/Session.ts index aa4d52075d34..e17bfaf1c2b9 100644 --- a/src/types/onyx/Session.ts +++ b/src/types/onyx/Session.ts @@ -1,6 +1,6 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import * as OnyxCommon from './OnyxCommon'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type * as OnyxCommon from './OnyxCommon'; type AutoAuthState = ValueOf; diff --git a/src/types/onyx/Task.ts b/src/types/onyx/Task.ts index 9d5c83ee4a40..804be21d3e1c 100644 --- a/src/types/onyx/Task.ts +++ b/src/types/onyx/Task.ts @@ -1,4 +1,4 @@ -import Report from './Report'; +import type Report from './Report'; type Task = { /** Title of the Task */ diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 53bfc36a4e47..8b7e26280305 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -1,7 +1,7 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import * as OnyxCommon from './OnyxCommon'; -import RecentWaypoint from './RecentWaypoint'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type * as OnyxCommon from './OnyxCommon'; +import type RecentWaypoint from './RecentWaypoint'; type Waypoint = { /** The name associated with the address of the waypoint */ diff --git a/src/types/onyx/TransactionViolation.ts b/src/types/onyx/TransactionViolation.ts index f7bc5ea1ee8b..dd7a9ef65746 100644 --- a/src/types/onyx/TransactionViolation.ts +++ b/src/types/onyx/TransactionViolation.ts @@ -1,46 +1,34 @@ +import type CONST from '@src/CONST'; + /** - * Names of transaction violations + * Names of violations. + * Derived from `CONST.VIOLATIONS` to maintain a single source of truth. */ -type ViolationName = - | 'allTagLevelsRequired' - | 'autoReportedRejectedExpense' - | 'billableExpense' - | 'cashExpenseWithNoReceipt' - | 'categoryOutOfPolicy' - | 'conversionSurcharge' - | 'customUnitOutOfPolicy' - | 'duplicatedTransaction' - | 'fieldRequired' - | 'futureDate' - | 'invoiceMarkup' - | 'maxAge' - | 'missingCategory' - | 'missingComment' - | 'missingTag' - | 'modifiedAmount' - | 'modifiedDate' - | 'nonExpensiworksExpense' - | 'overAutoApprovalLimit' - | 'overCategoryLimit' - | 'overLimit' - | 'overLimitAttendee' - | 'perDayLimit' - | 'receiptNotSmartScanned' - | 'receiptRequired' - | 'rter' - | 'smartscanFailed' - | 'someTagLevelsRequired' - | 'tagOutOfPolicy' - | 'taxAmountChanged' - | 'taxOutOfPolicy' - | 'taxRateChanged' - | 'taxRequired'; +type ViolationName = (typeof CONST.VIOLATIONS)[keyof typeof CONST.VIOLATIONS]; type TransactionViolation = { type: string; name: ViolationName; userMessage: string; - data?: Record; + data?: { + rejectedBy?: string; + rejectReason?: string; + amount?: string; + surcharge?: number; + invoiceMarkup?: number; + maxAge?: number; + tagName?: string; + formattedLimitAmount?: string; + categoryLimit?: string; + limit?: string; + category?: string; + brokenBankConnection?: boolean; + isAdmin?: boolean; + email?: string; + isTransactionOlderThan7Days?: boolean; + member?: string; + taxName?: string; + }; }; export type {TransactionViolation, ViolationName}; diff --git a/src/types/onyx/UserWallet.ts b/src/types/onyx/UserWallet.ts index 501e05a31ad0..1b903792912c 100644 --- a/src/types/onyx/UserWallet.ts +++ b/src/types/onyx/UserWallet.ts @@ -1,6 +1,6 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import * as OnyxCommon from './OnyxCommon'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type * as OnyxCommon from './OnyxCommon'; type WalletLinkedAccountType = 'debitCard' | 'bankAccount'; diff --git a/src/types/onyx/WalletAdditionalDetails.ts b/src/types/onyx/WalletAdditionalDetails.ts index e766ba4cfe50..da890b36bfef 100644 --- a/src/types/onyx/WalletAdditionalDetails.ts +++ b/src/types/onyx/WalletAdditionalDetails.ts @@ -1,4 +1,4 @@ -import * as OnyxCommon from './OnyxCommon'; +import type * as OnyxCommon from './OnyxCommon'; type WalletAdditionalDetails = { /** Questions returned by Idology */ diff --git a/src/types/onyx/WalletOnfido.ts b/src/types/onyx/WalletOnfido.ts index 7a65c0f710ef..bea6db81a87d 100644 --- a/src/types/onyx/WalletOnfido.ts +++ b/src/types/onyx/WalletOnfido.ts @@ -1,4 +1,4 @@ -import * as OnyxCommon from './OnyxCommon'; +import type * as OnyxCommon from './OnyxCommon'; type WalletOnfido = { /** Unique identifier returned from openOnfidoFlow then re-sent to ActivateWallet with Onfido response data */ diff --git a/src/types/onyx/WalletTerms.ts b/src/types/onyx/WalletTerms.ts index 5394f126c33c..b60a880e0aa0 100644 --- a/src/types/onyx/WalletTerms.ts +++ b/src/types/onyx/WalletTerms.ts @@ -1,4 +1,4 @@ -import * as OnyxCommon from './OnyxCommon'; +import type * as OnyxCommon from './OnyxCommon'; type WalletTerms = { /** Any error message to show */ diff --git a/src/types/onyx/WalletTransfer.ts b/src/types/onyx/WalletTransfer.ts index cebea543884b..3151ecb3ad5c 100644 --- a/src/types/onyx/WalletTransfer.ts +++ b/src/types/onyx/WalletTransfer.ts @@ -1,7 +1,7 @@ -import {ValueOf} from 'type-fest'; -import CONST from '@src/CONST'; -import * as OnyxCommon from './OnyxCommon'; -import PaymentMethod from './PaymentMethod'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; +import type * as OnyxCommon from './OnyxCommon'; +import type PaymentMethod from './PaymentMethod'; type WalletTransfer = { /** Selected accountID for transfer */ diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index efa1ae1fe630..7bd9c321be5e 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -1,62 +1,69 @@ -import Account from './Account'; -import AccountData from './AccountData'; -import BankAccount, {BankAccountList} from './BankAccount'; -import Beta from './Beta'; -import BlockedFromConcierge from './BlockedFromConcierge'; -import Card from './Card'; -import Credentials from './Credentials'; -import Currency from './Currency'; -import CustomStatusDraft from './CustomStatusDraft'; -import Download from './Download'; -import Form, {AddDebitCardForm, DateOfBirthForm} from './Form'; -import FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; -import Fund, {FundList} from './Fund'; -import IOU from './IOU'; -import Locale from './Locale'; -import Login, {LoginList} from './Login'; -import MapboxAccessToken from './MapboxAccessToken'; -import Modal from './Modal'; -import Network from './Network'; -import {OnyxUpdateEvent, OnyxUpdatesFromServer} from './OnyxUpdatesFromServer'; -import PersonalBankAccount from './PersonalBankAccount'; -import PersonalDetails, {PersonalDetailsList} from './PersonalDetails'; -import PlaidData from './PlaidData'; -import Policy from './Policy'; -import PolicyCategory, {PolicyCategories} from './PolicyCategory'; -import PolicyMember, {PolicyMembers} from './PolicyMember'; -import PolicyReportField from './PolicyReportField'; -import PolicyTag, {PolicyTags} from './PolicyTag'; -import PrivatePersonalDetails from './PrivatePersonalDetails'; -import RecentlyUsedCategories from './RecentlyUsedCategories'; -import RecentlyUsedReportFields from './RecentlyUsedReportFields'; -import RecentlyUsedTags from './RecentlyUsedTags'; -import RecentWaypoint from './RecentWaypoint'; -import ReimbursementAccount from './ReimbursementAccount'; -import ReimbursementAccountDraft from './ReimbursementAccountDraft'; -import Report from './Report'; -import ReportAction, {ReportActions} from './ReportAction'; -import ReportActionReactions from './ReportActionReactions'; -import ReportActionsDraft from './ReportActionsDraft'; -import ReportActionsDrafts from './ReportActionsDrafts'; -import ReportMetadata from './ReportMetadata'; -import ReportNextStep from './ReportNextStep'; -import ReportUserIsTyping from './ReportUserIsTyping'; -import Request from './Request'; -import Response from './Response'; -import ScreenShareRequest from './ScreenShareRequest'; -import SecurityGroup from './SecurityGroup'; -import Session from './Session'; -import Task from './Task'; -import Transaction from './Transaction'; -import {TransactionViolation, ViolationName} from './TransactionViolation'; -import User from './User'; -import UserLocation from './UserLocation'; -import UserWallet from './UserWallet'; -import WalletAdditionalDetails from './WalletAdditionalDetails'; -import WalletOnfido from './WalletOnfido'; -import WalletStatement from './WalletStatement'; -import WalletTerms from './WalletTerms'; -import WalletTransfer from './WalletTransfer'; +import type Account from './Account'; +import type AccountData from './AccountData'; +import type {BankAccountList} from './BankAccount'; +import type BankAccount from './BankAccount'; +import type Beta from './Beta'; +import type BlockedFromConcierge from './BlockedFromConcierge'; +import type Card from './Card'; +import type Credentials from './Credentials'; +import type Currency from './Currency'; +import type CustomStatusDraft from './CustomStatusDraft'; +import type Download from './Download'; +import type {AddDebitCardForm, DateOfBirthForm} from './Form'; +import type Form from './Form'; +import type FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; +import type {FundList} from './Fund'; +import type Fund from './Fund'; +import type IOU from './IOU'; +import type Locale from './Locale'; +import type {LoginList} from './Login'; +import type Login from './Login'; +import type MapboxAccessToken from './MapboxAccessToken'; +import type Modal from './Modal'; +import type Network from './Network'; +import type {OnyxUpdateEvent, OnyxUpdatesFromServer} from './OnyxUpdatesFromServer'; +import type PersonalBankAccount from './PersonalBankAccount'; +import type {PersonalDetailsList} from './PersonalDetails'; +import type PersonalDetails from './PersonalDetails'; +import type PlaidData from './PlaidData'; +import type Policy from './Policy'; +import type {PolicyCategories, PolicyCategory} from './PolicyCategory'; +import type {PolicyMembers} from './PolicyMember'; +import type PolicyMember from './PolicyMember'; +import type PolicyReportField from './PolicyReportField'; +import type {PolicyTag, PolicyTags} from './PolicyTag'; +import type PrivatePersonalDetails from './PrivatePersonalDetails'; +import type RecentlyUsedCategories from './RecentlyUsedCategories'; +import type RecentlyUsedReportFields from './RecentlyUsedReportFields'; +import type RecentlyUsedTags from './RecentlyUsedTags'; +import type RecentWaypoint from './RecentWaypoint'; +import type ReimbursementAccount from './ReimbursementAccount'; +import type ReimbursementAccountDraft from './ReimbursementAccountDraft'; +import type Report from './Report'; +import type {ReportActions} from './ReportAction'; +import type ReportAction from './ReportAction'; +import type ReportActionReactions from './ReportActionReactions'; +import type ReportActionsDraft from './ReportActionsDraft'; +import type ReportActionsDrafts from './ReportActionsDrafts'; +import type ReportMetadata from './ReportMetadata'; +import type ReportNextStep from './ReportNextStep'; +import type ReportUserIsTyping from './ReportUserIsTyping'; +import type Request from './Request'; +import type Response from './Response'; +import type ScreenShareRequest from './ScreenShareRequest'; +import type SecurityGroup from './SecurityGroup'; +import type Session from './Session'; +import type Task from './Task'; +import type Transaction from './Transaction'; +import type {TransactionViolation, ViolationName} from './TransactionViolation'; +import type User from './User'; +import type UserLocation from './UserLocation'; +import type UserWallet from './UserWallet'; +import type WalletAdditionalDetails from './WalletAdditionalDetails'; +import type WalletOnfido from './WalletOnfido'; +import type WalletStatement from './WalletStatement'; +import type WalletTerms from './WalletTerms'; +import type WalletTransfer from './WalletTransfer'; export type { Account, diff --git a/src/types/utils/CustomRefObject.ts b/src/types/utils/CustomRefObject.ts index aa726d7a0f86..13bb0f27a42e 100644 --- a/src/types/utils/CustomRefObject.ts +++ b/src/types/utils/CustomRefObject.ts @@ -1,4 +1,4 @@ -import {RefObject} from 'react'; +import type {RefObject} from 'react'; type CustomRefObject = RefObject & {onselectstart: () => boolean}; diff --git a/src/types/utils/EmptyObject.ts b/src/types/utils/EmptyObject.ts index aa8b538499cd..48be674f3c5c 100644 --- a/src/types/utils/EmptyObject.ts +++ b/src/types/utils/EmptyObject.ts @@ -1,4 +1,4 @@ -import Falsy from './Falsy'; +import type Falsy from './Falsy'; type EmptyObject = Record; diff --git a/src/types/utils/IconAsset.ts b/src/types/utils/IconAsset.ts index 45a79b8286ef..f5d193aaa993 100644 --- a/src/types/utils/IconAsset.ts +++ b/src/types/utils/IconAsset.ts @@ -1,5 +1,5 @@ -import {ImageSourcePropType} from 'react-native'; -import {SvgProps} from 'react-native-svg/lib/typescript'; +import type {ImageSourcePropType} from 'react-native'; +import type {SvgProps} from 'react-native-svg/lib/typescript'; type IconAsset = React.FC | ImageSourcePropType; diff --git a/src/types/utils/textRef.ts b/src/types/utils/textRef.ts index df0235f4ac0b..4e80f00b7bc6 100644 --- a/src/types/utils/textRef.ts +++ b/src/types/utils/textRef.ts @@ -1,4 +1,4 @@ -import {Text} from 'react-native'; +import type {Text} from 'react-native'; const textRef = (ref: React.RefObject) => ref as React.RefObject; diff --git a/src/types/utils/viewForwardedRef.ts b/src/types/utils/viewForwardedRef.ts index 3bc18495b153..87b26bfbab40 100644 --- a/src/types/utils/viewForwardedRef.ts +++ b/src/types/utils/viewForwardedRef.ts @@ -1,5 +1,5 @@ -import {ForwardedRef} from 'react'; -import {View} from 'react-native'; +import type {ForwardedRef} from 'react'; +import type {View} from 'react-native'; const viewForwardedRef = (ref: ForwardedRef) => ref as ForwardedRef; diff --git a/src/types/utils/viewRef.ts b/src/types/utils/viewRef.ts index 015d88cc5a8b..1fd9d186ba1f 100644 --- a/src/types/utils/viewRef.ts +++ b/src/types/utils/viewRef.ts @@ -1,4 +1,4 @@ -import {View} from 'react-native'; +import type {View} from 'react-native'; const viewRef = (ref: React.RefObject) => ref as React.RefObject; diff --git a/tests/perf-test/ModifiedExpenseMessage.perf-test.ts b/tests/perf-test/ModifiedExpenseMessage.perf-test.ts index 1997d55d8a05..5aa842155cb5 100644 --- a/tests/perf-test/ModifiedExpenseMessage.perf-test.ts +++ b/tests/perf-test/ModifiedExpenseMessage.perf-test.ts @@ -3,7 +3,7 @@ import Onyx from 'react-native-onyx'; import {measureFunction} from 'reassure'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {Policy, Report} from '@src/types/onyx'; +import type {Policy, Report} from '@src/types/onyx'; import ModifiedExpenseMessage from '../../src/libs/ModifiedExpenseMessage'; import createCollection from '../utils/collections/createCollection'; import createRandomPolicy from '../utils/collections/policies'; diff --git a/tests/perf-test/ReportActionsUtils.perf-test.ts b/tests/perf-test/ReportActionsUtils.perf-test.ts index d4a1b9b58e44..ea3b48bacf47 100644 --- a/tests/perf-test/ReportActionsUtils.perf-test.ts +++ b/tests/perf-test/ReportActionsUtils.perf-test.ts @@ -3,7 +3,8 @@ import {measureFunction} from 'reassure'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ReportAction, {ReportActions} from '@src/types/onyx/ReportAction'; +import type {ReportActions} from '@src/types/onyx/ReportAction'; +import type ReportAction from '@src/types/onyx/ReportAction'; import createCollection from '../utils/collections/createCollection'; import createRandomReportAction from '../utils/collections/reportActions'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; diff --git a/tests/perf-test/ReportUtils.perf-test.ts b/tests/perf-test/ReportUtils.perf-test.ts index 928d9a9fbdff..62b911fb0417 100644 --- a/tests/perf-test/ReportUtils.perf-test.ts +++ b/tests/perf-test/ReportUtils.perf-test.ts @@ -3,7 +3,7 @@ import {measureFunction} from 'reassure'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {PersonalDetails, Policy, Report, ReportAction} from '@src/types/onyx'; +import type {PersonalDetails, Policy, Report, ReportAction} from '@src/types/onyx'; import createCollection from '../utils/collections/createCollection'; import createPersonalDetails from '../utils/collections/personalDetails'; import createRandomPolicy from '../utils/collections/policies'; diff --git a/tests/perf-test/SidebarUtils.perf-test.ts b/tests/perf-test/SidebarUtils.perf-test.ts index 05143848f8b9..5606863f42e2 100644 --- a/tests/perf-test/SidebarUtils.perf-test.ts +++ b/tests/perf-test/SidebarUtils.perf-test.ts @@ -1,12 +1,13 @@ -import Onyx, {OnyxCollection} from 'react-native-onyx'; +import type {OnyxCollection} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import {measureFunction} from 'reassure'; import SidebarUtils from '@libs/SidebarUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {PersonalDetails} from '@src/types/onyx'; -import Policy from '@src/types/onyx/Policy'; -import Report from '@src/types/onyx/Report'; -import ReportAction from '@src/types/onyx/ReportAction'; +import type {PersonalDetails} from '@src/types/onyx'; +import type Policy from '@src/types/onyx/Policy'; +import type Report from '@src/types/onyx/Report'; +import type ReportAction from '@src/types/onyx/ReportAction'; import createCollection from '../utils/collections/createCollection'; import createPersonalDetails from '../utils/collections/personalDetails'; import createRandomPolicy from '../utils/collections/policies'; diff --git a/tests/unit/OptionsListUtilsTest.js b/tests/unit/OptionsListUtilsTest.js index efe7fbca7b14..9ac0186d2396 100644 --- a/tests/unit/OptionsListUtilsTest.js +++ b/tests/unit/OptionsListUtilsTest.js @@ -817,7 +817,7 @@ describe('OptionsListUtils', () => { const largeResultList = [ { title: '', - shouldShow: true, + shouldShow: false, indexOffset: 0, data: [ { diff --git a/tests/unit/PersistedRequests.ts b/tests/unit/PersistedRequests.ts index 79153efdc806..b1d05c96f12a 100644 --- a/tests/unit/PersistedRequests.ts +++ b/tests/unit/PersistedRequests.ts @@ -1,5 +1,5 @@ import * as PersistedRequests from '../../src/libs/actions/PersistedRequests'; -import Request from '../../src/types/onyx/Request'; +import type Request from '../../src/types/onyx/Request'; const request: Request = { command: 'OpenReport', diff --git a/tests/utils/collections/reportActions.ts b/tests/utils/collections/reportActions.ts index abc83eb82abe..747cbe5b6a1a 100644 --- a/tests/utils/collections/reportActions.ts +++ b/tests/utils/collections/reportActions.ts @@ -1,6 +1,6 @@ import {rand, randAggregation, randBoolean, randPastDate, randWord} from '@ngneat/falso'; import CONST from '@src/CONST'; -import {ReportAction} from '@src/types/onyx'; +import type {ReportAction} from '@src/types/onyx'; type ActionType = keyof typeof CONST.REPORT.ACTIONS.TYPE; diff --git a/tests/utils/collections/transaction.ts b/tests/utils/collections/transaction.ts index 5f7cd47de990..25b4a77c66dd 100644 --- a/tests/utils/collections/transaction.ts +++ b/tests/utils/collections/transaction.ts @@ -1,6 +1,6 @@ import {rand, randAmount, randBoolean, randPastDate, randWord} from '@ngneat/falso'; import CONST from '@src/CONST'; -import {Transaction} from '@src/types/onyx'; +import type {Transaction} from '@src/types/onyx'; export default function createRandomTransaction(index: number): Transaction { return {