From a2f0074fc27ff3b343941ee155f1ba95ceb97a17 Mon Sep 17 00:00:00 2001 From: neil-marcellini Date: Tue, 15 Oct 2024 12:44:48 -0700 Subject: [PATCH] Fix some ts errors --- src/libs/DistanceRequestUtils.ts | 2 +- src/types/onyx/Transaction.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/DistanceRequestUtils.ts b/src/libs/DistanceRequestUtils.ts index 6e4aed00308d..be41f88b8297 100644 --- a/src/libs/DistanceRequestUtils.ts +++ b/src/libs/DistanceRequestUtils.ts @@ -314,7 +314,7 @@ function getTaxableAmount(policy: OnyxEntry, customUnitRateID: string, d return amount * taxClaimablePercentage; } -function getDistanceUnit(transaction: OnyxEntry, mileageRate: OnyxEntry) { +function getDistanceUnit(transaction: OnyxEntry, mileageRate: OnyxEntry): Unit { return transaction?.comment?.customUnit?.distanceUnit ?? mileageRate?.unit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES; } diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 8f876f18cca5..d7d10e07f955 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -5,6 +5,7 @@ import type ONYXKEYS from '@src/ONYXKEYS'; import type CollectionDataSet from '@src/types/utils/CollectionDataSet'; import type {Participant, Split} from './IOU'; import type * as OnyxCommon from './OnyxCommon'; +import type {Unit} from './Policy'; import type RecentWaypoint from './RecentWaypoint'; import type ReportAction from './ReportAction'; import type {ViolationName} from './TransactionViolation'; @@ -102,7 +103,7 @@ type TransactionCustomUnit = { defaultP2PRate?: number | null; /** The unit for the distance/quantity */ - distanceUnit?: 'mi' | 'km'; + distanceUnit?: Unit; }; /** Types of geometry */