Let's say I have two objects, a car and a list of persons. Inside my car object I have a list of ID's representing passengers. I would like to create a decorator I can put on the list (ie. @personIDs public passengers: person[];
) so that, once the list is created I can replace the ID's with references to the actual object.
ex.
function personIDs(target: any, key: string) {
for(let id of target) id = persons.filter((p) => {return p.id == id;})[0];
}
My problem is that, as far as I can tell, I can only access the meta-data and not the actual values. Is there a work around or a simple elegant solution to this?
Aucun commentaire:
Enregistrer un commentaire