Switched on the @typescript-eslint/no-non-null-assertion rule in eslint.
Fixed the errors it threw up.
This commit is contained in:
@ -147,8 +147,8 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.voucher = voucher;
|
||||
this.form.setValue({
|
||||
date: moment(this.voucher.date, 'DD-MMM-YYYY').toDate(),
|
||||
source: (this.voucher.source as CostCentre).id!,
|
||||
destination: (this.voucher.destination as CostCentre).id!,
|
||||
source: (this.voucher.source as CostCentre).id ?? '',
|
||||
destination: (this.voucher.destination as CostCentre).id ?? '',
|
||||
amount: Math.abs(this.voucher.inventories.map((x) => x.amount).reduce((p, c) => p + c, 0)),
|
||||
addRow: {
|
||||
batch: '',
|
||||
@ -169,7 +169,10 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
addRow() {
|
||||
const formValue = this.form.value.addRow!;
|
||||
const formValue = this.form.value.addRow;
|
||||
if (formValue === undefined) {
|
||||
return;
|
||||
}
|
||||
const quantity = this.math.parseAmount(formValue.quantity, 2);
|
||||
const isConsumption = this.form.value.source === '7b845f95-dfef-fa4a-897c-f0baf15284a3';
|
||||
if (this.batch === null || quantity <= 0) {
|
||||
@ -288,9 +291,9 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
getVoucher(): Voucher {
|
||||
const formModel = this.form.value;
|
||||
this.voucher.date = moment(formModel.date).format('DD-MMM-YYYY');
|
||||
(this.voucher.source as CostCentre).id = formModel.source!;
|
||||
(this.voucher.destination as CostCentre).id = formModel.destination!;
|
||||
this.voucher.narration = formModel.narration!;
|
||||
(this.voucher.source as CostCentre).id = formModel.source ?? '';
|
||||
(this.voucher.destination as CostCentre).id = formModel.destination ?? '';
|
||||
this.voucher.narration = formModel.narration ?? '';
|
||||
return this.voucher;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user