I am using typescript
to program in Angular2. I have an object car.ts
the is as follows:
export class Car{
name: String;
door: {
position: String;
id: Number;
};
}
I have initialized the object in the following way:
constructor() {
this.door= new Door();
}
export class Door{
position: String;
ID: Number
}
And it works correctly. My problem comes when I try to initialize an array of objects:
export class Car{
name: String;
door: {
position: String;
id: Number;
};
color: [{
one: String;
two: String;
}]
}
and I try it in the following way;
constructor() {
this.color= new Color();
this.door= new Door();
}
export class Color{
one: String;
two: String;
}
The error is as follows:
Type Color is not assignable to type ...
I imagine the error is because the Receivers class does not create a Array