Switched on the @typescript-eslint/no-non-null-assertion rule in eslint.

Fixed the errors it threw up.
This commit is contained in:
2022-07-17 09:17:20 +05:30
parent c76696e022
commit 9f70ec2917
29 changed files with 144 additions and 111 deletions

View File

@ -158,7 +158,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
[this.receiptJournal] = this.voucher.journals.filter((x) => x.debit === 1);
this.form.setValue({
date: moment(this.voucher.date, 'DD-MMM-YYYY').toDate(),
receiptAccount: this.receiptJournal.account.id!,
receiptAccount: this.receiptJournal.account.id ?? '',
receiptAmount: this.receiptJournal.amount,
addRow: {
account: '',
@ -179,7 +179,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
}
addRow() {
const amount = this.math.parseAmount(this.form.value.addRow?.amount!, 2);
const amount = this.math.parseAmount(this.form.value.addRow?.amount ?? '0', 2);
const debit = -1;
if (this.account === null || amount <= 0) {
return;
@ -304,7 +304,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
const formModel = this.form.value;
this.voucher.date = moment(formModel.date).format('DD-MMM-YYYY');
this.receiptJournal.account.id = formModel.receiptAccount;
this.voucher.narration = formModel.narration!;
this.voucher.narration = formModel.narration ?? '';
return this.voucher;
}