From 761434d262e0c7690cd869db305ef344c89e4a54 Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Wed, 27 Mar 2024 22:37:54 -0700 Subject: [PATCH 1/4] Update type of employee list to indicate it's an array of PolicyMembers --- src/types/onyx/Policy.ts | 3 ++- src/types/onyx/PolicyMember.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 5165fa2ee128..1a60c6c7b3a8 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -1,6 +1,7 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type * as OnyxCommon from './OnyxCommon'; +import PolicyMember from "@src/types/onyx/PolicyMember"; type Unit = 'mi' | 'km'; @@ -320,7 +321,7 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback< submitsTo?: number; /** The employee list of the policy */ - employeeList?: []; + employeeList?: PolicyMember[]; /** The reimbursement choice for policy */ reimbursementChoice?: ValueOf; diff --git a/src/types/onyx/PolicyMember.ts b/src/types/onyx/PolicyMember.ts index f68fe194df0e..366a7ef7d530 100644 --- a/src/types/onyx/PolicyMember.ts +++ b/src/types/onyx/PolicyMember.ts @@ -4,6 +4,15 @@ type PolicyMember = OnyxCommon.OnyxValueWithOfflineFeedback<{ /** Role of the user in the policy */ role?: string; + /** Email of the user */ + email?: string; + + /** Email of the user this user forwards all approved reports to */ + forwardsTo?: string; + + /** Email of the user this user submits all reports to */ + submitsTo?: string; + /** * Errors from api calls on the specific user * {: 'error message', : 'error message 2'} From 811add0cc590543bd76795e9e080904aead00def Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Wed, 27 Mar 2024 22:59:29 -0700 Subject: [PATCH 2/4] Use OnyxTypes --- src/types/onyx/Policy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 1a60c6c7b3a8..a5227c5c3179 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -1,7 +1,7 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; +import type * as OnyxTypes from '@src/types/onyx'; import type * as OnyxCommon from './OnyxCommon'; -import PolicyMember from "@src/types/onyx/PolicyMember"; type Unit = 'mi' | 'km'; @@ -321,7 +321,7 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback< submitsTo?: number; /** The employee list of the policy */ - employeeList?: PolicyMember[]; + employeeList?: OnyxTypes.PolicyMembers; /** The reimbursement choice for policy */ reimbursementChoice?: ValueOf; From eb828edb32ab76f167c835b98d1a235c6f109b7f Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Wed, 27 Mar 2024 23:06:35 -0700 Subject: [PATCH 3/4] Lawd help me typescript --- src/types/onyx/Policy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index a5227c5c3179..e696753974b1 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -321,7 +321,7 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback< submitsTo?: number; /** The employee list of the policy */ - employeeList?: OnyxTypes.PolicyMembers; + employeeList?: OnyxTypes.PolicyMembers | []; /** The reimbursement choice for policy */ reimbursementChoice?: ValueOf; From 945aca253376577632a088b9f4cb51f490b7b913 Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Fri, 29 Mar 2024 14:39:38 -0700 Subject: [PATCH 4/4] ESLint --- src/types/onyx/Policy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 1ae929939471..ddb0c33c2f0c 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -1,6 +1,6 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; -import type * as OnyxTypes from '@src/types/onyx'; +import type * as OnyxTypes from '.'; import type * as OnyxCommon from './OnyxCommon'; type Unit = 'mi' | 'km';