Instanceof operator was not working so changed the way of checking it

This commit is contained in:
2022-07-17 08:17:13 +05:30
parent 4072733dfe
commit dbdd00119a
27 changed files with 36 additions and 44 deletions
@@ -74,8 +74,7 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
narration: new FormControl('', { nonNullable: true }),
});
this.accounts = this.form.controls.account.valueChanges.pipe(
map((x) => (x instanceof Account ? x.name : x)),
map((x) => (x !== null && x.length >= 1 ? x : null)),
map((x) => ((x as Account).name !== undefined ? (x as Account).name : (x as string))),
map((x) => (x !== null && x.length >= 1 ? x : null)),
debounceTime(150),
distinctUntilChanged(),
@@ -216,8 +215,8 @@ 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 instanceof Account) {
this.item.vendor = formModel.account;
if (formModel.account !== null && typeof formModel.account !== 'string') {
this.item.vendor = formModel.account!;
}
this.item.narration = formModel.narration!;
return this.item;