Skip to content

unacy / UnitMap

Type Alias: UnitMap<Edges>

ts
type UnitMap<Edges> = { [FU in FromUnits<Edges> as UnitsFor<FU>]: UnitAccessor<FU, Edges> };

Defined in: packages/core/src/registry.ts:143

A map of unit name → UnitAccessor for all registered source units.

Provides the fluent accessor shape: registry.Celsius.to.Fahrenheit(value) Only units that appear as the From side of a registered edge appear here.

Type Parameters

Type ParameterDescription
Edges extends readonly Edge[]Tuple of all registered conversion edges

Remarks

UnitMap is a type-level view over the registered Edges tuple. Each call to registry.register(from, to, fn) extends the Edges tuple at the type level, adding a new key to UnitMap. This means the accessible unit names grow monotonically — they are never removed once registered.

Released under the MIT License.