interface INamed {
name: string
}
class Flower implements INamed {
constructor(public name: string) {}
}
class City implements INamed {
constructor(public name: string) {}
}
class Star implements INamed {
constructor(public name: string) {}
}
let rows: INamed[] = [
new Flower("Rose"),
new City("Rome"),
new Star("Sirius")]
let list = rows
.map(r => r.name)
.join(", ")
//list is Rose, Rome, Sirius
console.log(`list is "${list}"`)