dimanche 26 août 2018

issues with === in typescript

I have an if block as given below:

if (this.totalTenants === 1) { this.newTenants.tenant2 = Object.assign({ name: null, number: null }, this.emptyTenant); this.newTenants.tenant3 = Object.assign({ name: null, number: null }, this.emptyTenant); this.newTenants.tenant4 = Object.assign({ name: null, number: null }, this.emptyTenant); this.newTenants.tenant2 = this.emptyTenant; this.newTenants.tenant3 = this.emptyTenant; this.newTenants.tenant4 = this.emptyTenant; this.newTenants.rentAmount = 3200; }

But when the value of this.totalTenants is 1 it doesn't go into the if block.

I'm working on Angular 6 with typescript.

If I if (this.totalTenants == 1) double equals sign ==

then the if block is executed but I get the error as displayed below: [tslint] == should be === (triple-equals)

Aucun commentaire:

Enregistrer un commentaire