EntityIdAndClassIdIterable Type alias

A collection of EntityIdAndClassIds, as used by TxnChangedEntities. For efficiency, the iterator supplied by this iterable returns the same EntityIdAndClassId object on each iteration. Therefore the objects must be copied if you intend to store references to them. For example, to populate an array from the iterable:

 function arrayFromIterable(entities: EntityIdAndClassIdIterable): EntityIdAndClassId[] {
   // NO! return Array.from(entities);
   const array = [];
   for (const entity of entities)
     array.push({...entity});

   return array;
 }

EntityIdAndClassIdIterable = Iterable<Readonly<EntityIdAndClassId>>

Defined in

Last Updated: 15 March, 2024