isUnitName Function
Type guard verifying a string is a known canonical built-in unit name.
Returns true only for unit names shipped in the bundled built-in canonical unit set.
Use this at system boundaries (e.g. when ingesting unit names from JSON config,
iModel metadata, user input, or other dynamic sources) before calling
UnitConversions.getConversion, convert, or isCompatible. Narrows the input
type to UnitName so subsequent calls type-check without casts.
isUnitName(value: string): value is UnitName
| Parameter | Type | Description |
|---|---|---|
| value | string |
Returns - value is UnitName
Defined in
- quantity/src/UnitConversions.ts Line 58
Last Updated: 27 May, 2026
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.