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
@@ -122,7 +122,10 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
}
addRow() {
const formValue = this.form.value.addRow!;
const formValue = this.form.value.addRow;
if (formValue === undefined) {
return;
}
const price = this.math.parseAmount(formValue.price, 2);
if (this.product === null || price <= 0) {
return;
@@ -215,10 +218,10 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
this.item.date = moment(formModel.date).format('DD-MMM-YYYY');
this.item.validFrom = moment(formModel.validFrom).format('DD-MMM-YYYY');
this.item.validTill = moment(formModel.validTill).format('DD-MMM-YYYY');
if (formModel.account !== null && typeof formModel.account !== 'string') {
this.item.vendor = formModel.account!;
if (formModel.account && typeof formModel.account !== 'string') {
this.item.vendor = formModel.account;
}
this.item.narration = formModel.narration!;
this.item.narration = formModel.narration ?? '';
return this.item;
}
}