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
@@ -69,7 +69,7 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
type: this.item.type,
isActive: this.item.isActive,
isReconcilable: this.item.isReconcilable,
costCentre: this.item.costCentre.id!,
costCentre: this.item.costCentre.id ?? '',
});
}
@@ -120,11 +120,11 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
getItem(): Account {
const formModel = this.form.value;
this.item.name = formModel.name!;
this.item.type = formModel.type!;
this.item.isActive = formModel.isActive!;
this.item.isReconcilable = formModel.isReconcilable!;
this.item.costCentre.id = formModel.costCentre!;
this.item.name = formModel.name ?? '';
this.item.type = formModel.type ?? 0;
this.item.isActive = formModel.isActive ?? true;
this.item.isReconcilable = formModel.isReconcilable ?? false;
this.item.costCentre.id = formModel.costCentre ?? '';
return this.item;
}
}
@@ -50,7 +50,7 @@ export class AccountListComponent implements OnInit, AfterViewInit {
const data = value as { list: Account[]; accountTypes: AccountType[] };
this.accountTypes = data.accountTypes;
data.list.forEach(
(x) => (x.typeName = this.accountTypes.find((y) => y.id === x.type)?.name!),
(x) => (x.typeName = this.accountTypes.find((y) => y.id === x.type)?.name ?? ''),
);
this.list = data.list;
});