Skip to content

Commit

Permalink
[TS migration][AddPersonalBankAccount] TS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-rebelo committed Jan 30, 2024
1 parent 2883bdb commit c0446fd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ const ONYXKEYS = {
POLICY_REPORT_FIELD_EDIT_FORM_DRAFT: 'policyReportFieldEditFormDraft',
REIMBURSEMENT_ACCOUNT_FORM: 'reimbursementAccount',
REIMBURSEMENT_ACCOUNT_FORM_DRAFT: 'reimbursementAccountDraft',
PERSONAL_BANK_ACCOUNT: 'personalBankAccountForm',
},
} as const;

Expand Down Expand Up @@ -545,6 +546,7 @@ type OnyxValues = {
// @ts-expect-error Different values are defined under the same key: ReimbursementAccount and ReimbursementAccountForm
[ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM]: OnyxTypes.Form;
[ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT]: OnyxTypes.Form;
[ONYXKEYS.FORMS.PERSONAL_BANK_ACCOUNT]: OnyxTypes.PersonalBankAccount;
};

type OnyxKeyValue<TOnyxKey extends (OnyxKey | OnyxCollectionKey) & keyof OnyxValues> = OnyxEntry<OnyxValues[TOnyxKey]>;
Expand Down
3 changes: 1 addition & 2 deletions src/pages/AddPersonalBankAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ function AddPersonalBankAccountPage({personalBankAccount, plaidData}: AddPersona
onButtonPress={() => exitFlow(true)}
/>
) : (
// @ts-expect-error TODO: Remove this once FormProvider (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript.
<FormProvider
formID={ONYXKEYS.PERSONAL_BANK_ACCOUNT}
formID={ONYXKEYS.FORMS.PERSONAL_BANK_ACCOUNT}
isSubmitButtonVisible={Boolean(selectedPlaidAccountId)}
submitButtonText={translate('common.saveAndContinue')}
scrollContextEnabled
Expand Down
7 changes: 5 additions & 2 deletions src/types/onyx/Form.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type * as OnyxCommon from './OnyxCommon';
import type PersonalBankAccount from './PersonalBankAccount';

type FormValueType = string | boolean | Date;
type FormValueType = string | boolean | Date | OnyxCommon.Errors;

type BaseForm = {
/** Controls the loading state of the form */
Expand Down Expand Up @@ -54,6 +55,8 @@ type PrivateNotesForm = Form<{
privateNotes: string;
}>;

type PersonalBankAccountForm = Form<PersonalBankAccount>;

export default Form;

export type {AddDebitCardForm, DateOfBirthForm, PrivateNotesForm, DisplayNameForm, FormValueType, NewRoomForm, BaseForm, IKnowATeacherForm, IntroSchoolPrincipalForm};
export type {AddDebitCardForm, DateOfBirthForm, PrivateNotesForm, DisplayNameForm, FormValueType, NewRoomForm, BaseForm, IKnowATeacherForm, IntroSchoolPrincipalForm, PersonalBankAccountForm};

0 comments on commit c0446fd

Please sign in to comment.