Answer the question
In order to leave comments, you need to log in
Is it possible to set a hybrid data type in ts?
export interface IRoomData {
adults: number;
children: number;
childrenAges: number[]|{age: any}[];
}
Answer the question
In order to leave comments, you need to log in
export interface IRoomData {
adults: number;
children: number;
childrenAges: number[]|{age: any}[];
}
if(this.roomsData){
this.roomsData = this.roomsData.map((room) =>{
for(let i = 0; i < room.childrenAges.length; i++){
room.childrenAges[i] = {age: room.childrenAges[i]};
}
return room;
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question