Imagine a scenario where we have a slider component with an Input that can accept either Products or Teasers.
public productsWithTeasers: (Product | Teaser)[];
When attempting to iterate through this array, an error is thrown in VS Code.
<div *ngFor="let product of productsWithTeasers"> {{ product.externalId }}</div>
Identifier 'externalId' is not defined. '<anonymous>' does not contain such a memberAngular
What is the correct approach to solving this issue?
Please note that the two objects are not alike, so using extend in interfaces is not desired in this case.