An alternative method is to use Object.keys
,
class Item { name: string; desc: string; meta: string } class ViewItem { name: string; desc: string; hidden: boolean;
Using:
let arr1: Item[] = [ { name: "John Doe", desc: "blah", meta: "blah blah" } ]; let arr2: ViewItem[] = arr1.map(item => new ViewItem(item));
Playground
source share