I'm developing an Angular 2 application. This the first time I do something with Angular or Typescript.
I have this variable inside of a class:
public products: IProduct[];
IProduct is:
interface IProduct {
productCode: string;
description: string;
lawId: number;
name: string;
comment: string;
emvoProduct?: IEmvoProduct; // ?: Optional.
}
Is there any way to set it to undefined?
When I do this:
this.products = undefined;
I get an error saying:
(TS) Type 'undefined' cannot be converted to type 'IProduct[]'.