In my code, there is an interface defined as Products
export interface Products{
category: string;
imageUrl: string;
price: number;
title: string;
}
Within my component, I have a variable named products which is an array of type Products
products: Products[];
I am currently attempting to map the response from my service to the products variable, but I encounter an error stating Type
'{}[]' is not assignable to type 'Products[]'
The cause of this error is unclear to me at the moment
this.subscription = this.productService
.getAll()
.subscribe(
products =>
(this.products = products.map(p => ({ ...(p.payload.val() as {}) }))),
)