From f83ae7c7caa5f9684db48b9b8873b7fa804c9ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miika=20H=C3=A4nninen?= Date: Tue, 19 Sep 2017 12:28:05 +0300 Subject: [PATCH] Add global definition block --- types/big.js/index.d.ts | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/types/big.js/index.d.ts b/types/big.js/index.d.ts index a6634edef0..3559dda9ca 100644 --- a/types/big.js/index.d.ts +++ b/types/big.js/index.d.ts @@ -278,3 +278,48 @@ export interface Big { } export const Big: BigConstructor; + +// Helpers to allow referencing Big and BigConstructor from inside the global declaration without creating a self reference +/* tslint:disable:strict-export-declare-modifiers */ +type Big_ = Big; +type BigConstructor_ = BigConstructor; +type BigSource_ = BigSource; +/* tslint:enable:strict-export-declare-modifiers */ + +declare global { + namespace BigJs { + type Big = Big_; + type BigConstructor = BigConstructor_; + type BigSource = BigSource_; + + const enum Comparison { + GT = 1, + EQ = 0, + LT = -1, + } + + const enum RoundingMode { + /** + * Rounds towards zero. + * I.e. truncate, no rounding. + */ + RoundDown = 0, + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds away from zero. + */ + RoundHalfUp = 1, + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards even neighbour. + */ + RoundHalfEven = 2, + /** + * Rounds away from zero. + */ + RoundUp = 3, + } + } + + const Big: BigJs.BigConstructor; +}