I am new to angular and started working on version 12 and I am stuck in a point. Where I want to iterate in my union array in the template but it gives me error.
Error: Type 'IBasketItem[] | IOrderItem[]' is not assignable to type 'NgIterable'.
this is my union array in the component on which I want to iterate.
@Input() items: IBasketItem[] | IOrderItem[] = [];
this is the template code
<tr *ngFor="let item of items" class="border-0">
it gives me a red line under the ' of ' keyword with above mentioned error
here is the IBasketItem interface
export interface IBasketItem {
id: number;
productName: string;
price: number;
quantity: number;
pictureUrl: string;
brand: string;
type: string;
}
and this is the IOrderItem interface
export interface IOrderItem {
productId: number;
productName: string;
pictureUrl: string;
price: number;
quantity: number;
}
I will be thankful if someone suggest a solution.