Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
Typescript thinks boolean check is a string

I'm running into an issue when I'm trying to check if all of the properties in an object are populated and assigning the result to a boolean. This is the code:

this.isAddressValid = address.street && address.city && address.state && address.zip && address.country;

When I leave it like this, I get an error that states: Type 'string' is not assignable to type 'boolean'

But it seems to work if I add a simple conditional to the end:

this.isAddressValid = address.street && address.city && address.state && address.zip && address.country ? true : false;

I'm wondering why this is happening. Shouldn't the statement become a boolean by using the && operator? Why do I need to add the conditional for this to work?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!