Typescript: error TS2740: Type ‘{}’ is missing the following properties from type ‘Product[]’: length, pop, push, concat, and 26 more

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?

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.

constructor(
route:ActivatedRoute,
productService: ProductService ) {
productService
.getAll()
.switchMap(products => {
//getting compile error at below line for this.products
this.products = products;
return route.queryParamMap;
})
.subscribe(params => {
this.category = params.get('category');
this.filteredProducts = (this.category) ?
this.products.filter(p => p.category === this.category) :
this.products;
});
}


switchMap observable returns result for one item at a time, here there is an array list. How do I make it work.

Source: New feed