From 47787c0b0b846d5f4a057661efdd05d8786032f1 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 6 Apr 2020 23:32:01 +0530 Subject: make linter less grumpy --- src/util/amounts.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/util/amounts.ts') diff --git a/src/util/amounts.ts b/src/util/amounts.ts index f0a4f1d72..da1c19233 100644 --- a/src/util/amounts.ts +++ b/src/util/amounts.ts @@ -22,10 +22,10 @@ * Imports. */ import { - typecheckedCodec, makeCodecForObject, codecForString, codecForNumber, + Codec, } from "./codec"; /** @@ -66,14 +66,12 @@ export interface AmountJson { readonly currency: string; } -export const codecForAmountJson = () => - typecheckedCodec( +export const codecForAmountJson = (): Codec => makeCodecForObject() .property("currency", codecForString) .property("value", codecForNumber) .property("fraction", codecForNumber) - .build("AmountJson"), - ); + .build("AmountJson"); /** * Result of a possibly overflowing operation. @@ -100,7 +98,7 @@ export function getZero(currency: string): AmountJson { }; } -export function sum(amounts: AmountJson[]) { +export function sum(amounts: AmountJson[]): Result { if (amounts.length <= 0) { throw Error("can't sum zero amounts"); } @@ -287,7 +285,7 @@ export function parseOrThrow(s: string): AmountJson { * Convert a float to a Taler amount. * Loss of precision possible. */ -export function fromFloat(floatVal: number, currency: string) { +export function fromFloat(floatVal: number, currency: string): AmountJson { return { currency, fraction: Math.floor((floatVal - Math.floor(floatVal)) * fractionalBase), -- cgit v1.2.3