import { type UnitFormatOptions } from "./format.js";
import { ImmutableMap, type MapKey } from "./map.js";
import type { ImmutableObject } from "./object.js";
/** Conversion from one unit to another (either an amount to multiple by, or a function to convert). */
type Conversion = number | ((num: number) => number);
/** Set of possible conversions for a set of items. */
type Conversions<T extends string> = {
    readonly [K in T]?: Conversion;
};
interface UnitProps<T extends string> extends UnitFormatOptions {
    /** Conversions to other units (typically needs at least the base conversion, unless it's already the base unit). */
    readonly to?: Conversions<T>;
}
/** Represent a unit. */
export declare class Unit<K extends string> {
    private readonly _to;
    /** `UnitList` this unit belongs to. */
    readonly list: UnitList<K>;
    /** String key for this unit, e.g. `kilometer` */
    readonly key: K;
    /** Possible options for formatting these units. */
    readonly options: Readonly<UnitFormatOptions> | undefined;
    constructor(
    /** `UnitList` this unit belongs to. */
    list: UnitList<K>, 
    /** String key for this unit, e.g. `kilometer` */
    key: K, 
    /** Props to configure this unit. */
    { to, ...options }: UnitProps<K>);
    /** Convert an amount from this unit to another unit. */
    to(amount: number, targetKey?: K): number;
    /** Convert an amount from another unit to this unit. */
    from(amount: number, sourceKey?: K): number;
    /** Convert an amount from this unit to another unit (must specify another `Unit` instance). */
    private _convertTo;
    /**
     * Format an amount with a given unit of measure, e.g. `12 kg` or `29.5 l`
     * - Uses `Intl.NumberFormat` if this is a supported unit (so e.g. `ounce` is translated to e.g. `Unze` in German).
     * - Polyfills unsupported units to use long/short form based on `options.unitDisplay`.
     */
    format(amount: number, options?: UnitFormatOptions): string;
}
/**
 * Represent a list of units.
 * - Has a known base unit at `.base`
 * - Can get required units from `.unit()`
 * - Cannot have additional units added after it is created.
 */
export declare class UnitList<K extends string> extends ImmutableMap<K, Unit<K>> {
    readonly base: Unit<K>;
    constructor(units: ImmutableObject<K, UnitProps<K>>);
    /** Convert an amount from a unit to another unit. */
    convert(amount: number, sourceKey: K, targetKey: K): number;
    /**
     * Require a unit from this list.
     * @throws RequiredError if the unit key is not found.
     */
    require(key: K): Unit<K>;
}
/** Percentage units. */
export declare const PERCENT_UNITS: UnitList<"percent">;
export type PercentUnitKey = MapKey<typeof PERCENT_UNITS>;
/** Point units. */
export declare const POINT_UNITS: UnitList<"basis-point" | "percentage-point">;
export type PointUnitKey = MapKey<typeof POINT_UNITS>;
/** Angle units. */
export declare const ANGLE_UNITS: UnitList<"degree" | "gradian" | "radian">;
export type AngleUnitKey = MapKey<typeof ANGLE_UNITS>;
/** Mass units. */
export declare const MASS_UNITS: UnitList<"gram" | "kilogram" | "milligram" | "ounce" | "pound" | "stone">;
export type MassUnitKey = MapKey<typeof MASS_UNITS>;
/** Length units. */
export declare const LENGTH_UNITS: UnitList<"centimeter" | "foot" | "furlong" | "inch" | "kilometer" | "meter" | "mile" | "millimeter" | "yard">;
export type LengthUnitKey = MapKey<typeof LENGTH_UNITS>;
/** Speed units. */
export declare const SPEED_UNITS: UnitList<"kilometer-per-hour" | "meter-per-second" | "mile-per-hour">;
export type SpeedUnitKey = MapKey<typeof SPEED_UNITS>;
/** Area units. */
export declare const AREA_UNITS: UnitList<"acre" | "hectare" | "square-centimeter" | "square-foot" | "square-inch" | "square-kilometer" | "square-meter" | "square-millimeter" | "square-yard">;
export type AreaUnitKey = MapKey<typeof AREA_UNITS>;
/** Volume units. */
export declare const VOLUME_UNITS: UnitList<"cubic-centimeter" | "cubic-foot" | "cubic-inch" | "cubic-meter" | "cubic-yard" | "imperial-fluid-ounce" | "imperial-gallon" | "imperial-pint" | "imperial-quart" | "liter" | "milliliter" | "us-fluid-ounce" | "us-gallon" | "us-pint" | "us-quart">;
export type VolumeUnitKey = MapKey<typeof VOLUME_UNITS>;
/** Temperature units. */
export declare const TEMPERATURE_UNITS: UnitList<"celsius" | "fahrenheit" | "kelvin">;
export type TemperatureUnitKey = MapKey<typeof TEMPERATURE_UNITS>;
export {};
