@epicallan/money-ts
Version:
TypeScript library for type-safe and lossless encoding and manipulation of world currencies and precious metals
14 lines (13 loc) • 805 B
TypeScript
import { Newtype } from 'newtype-ts';
import { Eq } from 'fp-ts/Eq';
import { Ord } from 'fp-ts/Ord';
import { Dense } from './Dense';
import * as PR from './PositiveRational';
export interface ExchangeRate<S, D> extends Newtype<['ExchangeRate', S, D], PR.PositiveRational> {
}
export declare const wrap: <S, D>(r: PR.PositiveRational) => ExchangeRate<S, D>;
export declare const unwrap: <S, D>(er: ExchangeRate<S, D>) => PR.PositiveRational;
export declare const exchange: <S extends string, D extends string>(er: ExchangeRate<S, D>) => (d: Dense<S>) => Dense<D>;
export declare function compose<A, B, C>(bc: ExchangeRate<B, C>, ab: ExchangeRate<A, B>): ExchangeRate<A, C>;
export declare const getEq: <S, D>() => Eq<ExchangeRate<S, D>>;
export declare const getOrd: <S, D>() => Ord<ExchangeRate<S, D>>;