/** @packageDocumentation * @module Quantity */ import { type UnitConversionProps } from "./Interfaces"; import { Phenomena, type PhenomenonName, type UnitName } from "./generated/Units.generated"; /** 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. * * @beta */ export declare function isUnitName(value: string): value is UnitName; /** Returns the package's default built-in persistence unit for a supported bundled built-in phenomenon. * * This helper is intentionally limited to the built-in canonical unit set shipped with `@itwin/core-quantity`. * `Phenomena.LENGTH_RATIO` is intentionally excluded because the bundled built-in unit set does not yet provide an agreed default for that phenomenon. * For schema-defined, custom, or iModel-specific persistence units, use a `UnitsProvider`-based workflow instead. * * @beta */ export declare function getDefaultPersistenceUnit(phenomenon: Exclude): UnitName; /** One-stop unit conversion helpers for the built-in canonical unit set generated from `@bentley/units-schema`. * This surface is synchronous and only supports built-in canonical unit names shipped with `core-quantity`. * `getConversion(...)` returns `UnitConversionProps` and uses `error: true` as the compatibility sentinel for known-but-incompatible built-in units. * `convert(...)` and `convertValue(...)` are the throwing application helpers to use when invalid conversion metadata should fail fast. * `isCompatible(...)` is the explicit built-in compatibility check to use before applying a conversion when a non-throwing branch is preferred. * For schema-defined, custom, or provider-resolved units outside that built-in set, use a `UnitsProvider`-based workflow instead. * @beta */ export declare const UnitConversions: { readonly getConversion: (fromUnit: UnitName, toUnit: UnitName) => UnitConversionProps; readonly convert: (fromUnit: UnitName, toUnit: UnitName, value: number) => number; readonly convertValue: (value: number, conversion: UnitConversionProps) => number; readonly isCompatible: (fromUnit: UnitName, toUnit: UnitName) => boolean; }; //# sourceMappingURL=UnitConversions.d.ts.map