Skip to content

Commit

Permalink
Fix ts errors after merging main
Browse files Browse the repository at this point in the history
  • Loading branch information
VickyStash committed Oct 16, 2023
1 parent 0aa6dfb commit 3c0246c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/libs/actions/BankAccounts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Onyx from 'react-native-onyx';
import {ValueOf} from 'type-fest';
import CONST from '../../CONST';
import * as API from '../API';
import ONYXKEYS from '../../ONYXKEYS';
Expand All @@ -11,6 +10,7 @@ import * as ReimbursementAccount from './ReimbursementAccount';
import type PlaidBankAccount from '../../types/onyx/PlaidBankAccount';
import type {ACHContractStepProps, BankAccountStepProps, CompanyStepProps, OnfidoData, ReimbursementAccountProps, RequestorStepProps} from '../../types/onyx/ReimbursementAccountDraft';
import type {OnyxData} from '../../types/onyx/Request';
import type {BankAccountStep, BankAccountSubStep} from '../../types/onyx/ReimbursementAccount';

export {
goToWithdrawalAccountSetupStep,
Expand All @@ -29,9 +29,9 @@ export {openOnfidoFlow, answerQuestionsForWallet, verifyIdentity, acceptWalletTe

type BankAccountCompanyInformation = BankAccountStepProps & CompanyStepProps & ReimbursementAccountProps;

type BankAccountStep = ValueOf<typeof CONST.BANK_ACCOUNT.STEP> | '';
type ReimbursementAccountStep = BankAccountStep | '';

type BankAccountSubStep = ValueOf<typeof CONST.BANK_ACCOUNT.SUBSTEP> | '';
type ReimbursementAccountSubStep = BankAccountSubStep | '';

function clearPlaid(): Promise<void> {
Onyx.set(ONYXKEYS.PLAID_LINK_TOKEN, '');
Expand Down Expand Up @@ -67,7 +67,7 @@ function clearOnfidoToken() {
/**
* Helper method to build the Onyx data required during setup of a Verified Business Bank Account
*/
function getVBBADataForOnyx(currentStep: BankAccountStep = undefined): OnyxData {
function getVBBADataForOnyx(currentStep?: BankAccountStep): OnyxData {
return {
optimisticData: [
{
Expand Down Expand Up @@ -285,7 +285,7 @@ function validateBankAccount(bankAccountID: number, validateCode: string) {
API.write('ValidateBankAccountWithTransactions', parameters, onyxData);
}

function openReimbursementAccountPage(stepToOpen: BankAccountStep, subStep: BankAccountSubStep, localCurrentStep: BankAccountStep) {
function openReimbursementAccountPage(stepToOpen: ReimbursementAccountStep, subStep: ReimbursementAccountSubStep, localCurrentStep: ReimbursementAccountStep) {
const onyxData: OnyxData = {
optimisticData: [
{
Expand Down Expand Up @@ -317,9 +317,9 @@ function openReimbursementAccountPage(stepToOpen: BankAccountStep, subStep: Bank
};

type OpenReimbursementAccountPageParams = {
stepToOpen: BankAccountStep;
subStep: BankAccountSubStep;
localCurrentStep: BankAccountStep;
stepToOpen: ReimbursementAccountStep;
subStep: ReimbursementAccountSubStep;
localCurrentStep: ReimbursementAccountStep;
};

const parameters: OpenReimbursementAccountPageParams = {
Expand Down
12 changes: 10 additions & 2 deletions src/types/onyx/ReimbursementAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import {ValueOf} from 'type-fest';
import * as OnyxCommon from './OnyxCommon';
import CONST from '../../CONST';

type BankAccountStep = ValueOf<typeof CONST.BANK_ACCOUNT.STEP>;

type BankAccountSubStep = ValueOf<typeof CONST.BANK_ACCOUNT.SUBSTEP>;

type ACHData = {
/** Step of the setup flow that we are on. Determines which view is presented. */
currentStep: ValueOf<typeof CONST.BANK_ACCOUNT.STEP>;
currentStep: BankAccountStep;

/** Optional subStep we would like the user to start back on */
subStep?: ValueOf<typeof CONST.BANK_ACCOUNT.SUBSTEP>;
subStep?: BankAccountSubStep;

/** Bank account state */
state?: string;
Expand Down Expand Up @@ -38,7 +42,11 @@ type ReimbursementAccount = {
/** Any additional error message to show */
errors?: OnyxCommon.Errors;

/** Draft step of the setup flow from Onyx */
draftStep?: BankAccountStep;

pendingAction?: OnyxCommon.PendingAction;
};

export default ReimbursementAccount;
export type {BankAccountStep, BankAccountSubStep};

0 comments on commit 3c0246c

Please sign in to comment.