title: Typescript: error TS2740: Type '{}' is missing the following properties from type 'Product[]': length, pop, push, concat, and 26 more
body: <p>Using Angular 4, I am getting array list from firebase db inside an observable. How to change the type of an observable to an array or vice versa to make it work?</p>
  
  <p>There is no different function that i have written. I am using an inbuilt function switchMap, inside which am assigning a Products array. I am not able to figure out how to change or make switchMap observable into array observable.</p>
  
  <pre><code>constructor(
      route:ActivatedRoute,
      productService: ProductService ) { 
        productService
          .getAll()
          .switchMap(products =&gt; {
        //getting compile error at below line for this.products
            this.products = products;
            return route.queryParamMap;
          })
          .subscribe(params =&gt; {
            this.category = params.get('category');
            this.filteredProducts = (this.category) ? 
              this.products.filter(p =&gt; p.category === this.category) :
              this.products;
      });
    }
  </code></pre>
  
  <p>switchMap observable returns result for one item at a time, here there is an array list. How do I make it work.</p>