I'm tired of these old-school single-line statements and looked up one-line solutions in TypeScript. The following one is pretty clean in my eyes:

if (this.books.length === 0) this.userObservableService.getBooks();

// JavaScript single line 'if' statement  
// Instead of
// if (this.books.length === 0) {
//  this.userObservableService.getBooks()
// }

 

 

 

Saved you some valuable time?

Received 100 so far from 4 kind contributors.