Skip to content

BoundedOptions

BoundedOptions<TStorage> = { capacity: number; storage?: TStorage; } | { capacity?: never; storage: TStorage & IBounded; }

Defined in: packages/data/src/collection/ibounded.ts:34

Constructor options for a bounded collection.

The capacity comes from exactly one of two places: the capacity option, or a storage that carries its own (FixedVector, or any other ICapacityBound storage). Having to state it in both places is what would otherwise force a separate class per fixed-size collection; letting the storage answer for itself makes new BoundedQueue(undefined, { storage: new FixedVector(1024) }) enough.

Passing both is allowed, and then capacity must not exceed the storage’s.

TStorage

The storage capability tier the collection requires.