Home > OS >  Type 'boolean' is not assignable to type 'string'
Type 'boolean' is not assignable to type 'string'

Time:04-08

toggleserver

//////!this code is not working showing the error [Type 'boolean' is not assignable to type 'string']////////////need a little help toggleserverstatus () {

this.statusflag = !this.statusflag;

if (this.statusflag ==  true) {

  this.serverstatus='online';
}
return this.serverstatus;

}

}

CodePudding user response:

You have quotes around the initial assignment of what you wanted to be False to statusflag. 'false' is not the same as False.

  • Related