From f159c7ba5f368b913aa294e6bb9c320cf8454f1d Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 20 Jun 2026 16:40:04 +0700 Subject: [PATCH] fix(client): resolve type errors --- .../transfer-balance-dialog.component.ts | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts b/apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts index 34a66b156..d4717b4d3 100644 --- a/apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts +++ b/apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts @@ -64,11 +64,17 @@ export class GfTransferBalanceDialogComponent { } ); - this.transferBalanceForm.get('fromAccount').valueChanges.subscribe((id) => { - this.currency = this.accounts.find((account) => { - return account.id === id; - }).currency; - }); + this.transferBalanceForm + .get('fromAccount') + ?.valueChanges.subscribe((id) => { + const currency = this.accounts.find((account) => { + return account.id === id; + })?.currency; + + if (currency) { + this.currency = currency; + } + }); } public onCancel() { @@ -77,20 +83,22 @@ export class GfTransferBalanceDialogComponent { public onSubmit() { const account: TransferBalanceDto = { - accountIdFrom: this.transferBalanceForm.get('fromAccount').value, - accountIdTo: this.transferBalanceForm.get('toAccount').value, - balance: this.transferBalanceForm.get('balance').value + accountIdFrom: this.transferBalanceForm.get('fromAccount')?.value, + accountIdTo: this.transferBalanceForm.get('toAccount')?.value, + balance: this.transferBalanceForm.get('balance')?.value }; this.dialogRef.close({ account }); } - private compareAccounts(control: AbstractControl): ValidationErrors { + private compareAccounts(control: AbstractControl): ValidationErrors | null { const accountFrom = control.get('fromAccount'); const accountTo = control.get('toAccount'); - if (accountFrom.value === accountTo.value) { + if (accountFrom?.value === accountTo?.value) { return { invalid: true }; } + + return null; } }