/** * The string representation of a measurement. */ type Measurement$4 = `${Value}${Unit}`; /** * The tuple representation of a measurement. */ type Measurement$3 = readonly [value: Value, unit: Unit]; /** * The object representation of a measurement. * * @template Unit The type of the unit of measurement. * @template Value The type of the value of the measurement. */ type Measurement$2 = Number & { readonly value: Value; readonly unit: Unit; }; /** * Represents a dimension measurement. * @template Units - The units of the dimension. */ type Measurement$1 = Measurement$2 & Alternatives; /** * Represents a collection of alternative measurements for different units. * * @template Units - The string literal type representing the available units. */ type Alternatives = { readonly [unit in Units]: Measurement$1; }; /** * Represents a measurement with a specific unit and value. * * @template Unit - The type of unit for the measurement. * @template Value - The type of value for the measurement. */ type Measurement = Measurement$4 | Measurement$3 | Measurement$2 | Measurement$1; /** * Performs an arithmetic operation on a list of measurements. * The measurements are converted to a common unit before the operation is performed. * * @template Unit - The unit type of the measurements. * @param operation - The arithmetic operation to perform on the measurements. * @param measurements - The list of measurements to perform the operation on. * @returns The result of the arithmetic operation as a new measurement, or undefined if the list of measurements is empty or invalid. */ declare function arithmeticOperation(operation: (a: number, b: number) => number, ...measurements: Measurement[]): Measurement | undefined; declare const add: (...args: Measurement[]) => Measurement | undefined; declare const subtract: (...args: Measurement[]) => Measurement | undefined; declare function multiply(multiplicand: Measurement, multiplier: number): Measurement; declare function divide(dividend: Measurement, divisor: number): Measurement; declare function power(base: Measurement, exponent: number): Measurement; declare function root(radicand: Measurement, index: number): Measurement; declare function logarithm(antilogarithm: Measurement, base: number): Measurement; declare const areEqual: (args_0: Measurement, args_1: Measurement, ...args: Measurement[]) => boolean | undefined; declare const greaterThan: (args_0: Measurement, args_1: Measurement, ...args: Measurement[]) => boolean | undefined; declare const greaterThanOrEqual: (args_0: Measurement, args_1: Measurement, ...args: Measurement[]) => boolean | undefined; declare const lessThan: (args_0: Measurement, args_1: Measurement, ...args: Measurement[]) => boolean | undefined; declare const lessThanOrEqual: (args_0: Measurement, args_1: Measurement, ...args: Measurement[]) => boolean | undefined; declare const notEqual: (args_0: Measurement, args_1: Measurement, ...args: Measurement[]) => boolean | undefined; /** * Performs a logical operation on a series of measurements. * The measurements are converted to a common unit before the operation is performed. * * @template Unit - The unit of measurement. * @param operation - The logical operation to perform on the measurements. * @param measurements - The measurements to perform the operation on. * @returns The result of the logical operation. */ declare function logicalOperation(operation: >(a: M, b: M) => boolean, ...measurements: [Measurement, Measurement, ...Measurement[]]): boolean | undefined; /** * Returns the ratio between two compatible measurements. * * Measurements with the same unit are compared directly. Measurements with * different units are converted only when at least one input is a dimension * measurement. */ declare function proportion(numerator: Measurement, denominator: Measurement): number | undefined; /** * Converts an array of measurements to a common unit. * * @param measurements - The array of measurements to be converted. * @returns An array of measurements in a common unit, or `undefined` if the measurements can't be converted to a common unit. * @template Unit - The type of unit for the measurements. */ declare function toCommonUnit(...measurements: Measurement[]): Measurement[] | undefined; export { add, areEqual, arithmeticOperation, divide, greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, logarithm, logicalOperation, multiply, notEqual, power, proportion, root, subtract, toCommonUnit };