55
66// Documentation: http://mikemcl.github.io/bignumber.js/
77//
8- // Exports:
9- //
10- // class BigNumber (default export)
8+ // class BigNumber
119// type BigNumber.Constructor
1210// type BigNumber.ModuloMode
1311// type BigNumber.RoundingMode
3129//
3230// The use of compiler option `--strictNullChecks` is recommended.
3331
34- export default BigNumber ;
35-
36- export namespace BigNumber {
32+ declare namespace BigNumber {
3733
3834 /** See `BigNumber.config` (alias `BigNumber.set`) and `BigNumber.clone`. */
3935 interface Config {
@@ -324,10 +320,10 @@ export namespace BigNumber {
324320 type Constructor = typeof BigNumber ;
325321 type ModuloMode = 0 | 1 | 3 | 6 | 9 ;
326322 type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ;
327- type Value = string | number | Instance ;
323+ type Value = string | number | bigint | Instance ;
328324}
329325
330- export declare class BigNumber implements BigNumber . Instance {
326+ declare class BigNumber implements BigNumber . Instance {
331327
332328 /** Used internally to identify a BigNumber instance. */
333329 private readonly _isBigNumber : true ;
@@ -343,7 +339,7 @@ export declare class BigNumber implements BigNumber.Instance {
343339
344340 /**
345341 * Returns a new instance of a BigNumber object with value `n`, where `n` is a numeric value in
346- * the specified `base`, or base 10 if `base` is omitted or is `null` or `undefined` .
342+ * the specified `base`, or base 10 if `base` is omitted.
347343 *
348344 * ```ts
349345 * x = new BigNumber(123.4567) // '123.4567'
@@ -485,17 +481,16 @@ export declare class BigNumber implements BigNumber.Instance {
485481 * @param n A numeric value.
486482 * @param [base] The base of n.
487483 */
488- comparedTo ( n : BigNumber . Value , base ?: number ) : number ;
484+ comparedTo ( n : BigNumber . Value , base ?: number ) : 1 | - 1 | 0 | null ;
489485
490486 /**
491487 * Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode
492488 * `roundingMode` to a maximum of `decimalPlaces` decimal places.
493489 *
494- * If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of
495- * decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is
496- * ±`Infinity` or `NaN`.
490+ * If `decimalPlaces` is omitted, the return value is the number of decimal places of the value of
491+ * this BigNumber, or `null` if the value of this BigNumber is ±`Infinity` or `NaN`.
497492 *
498- * If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
493+ * If `roundingMode` is omitted, `ROUNDING_MODE` is used.
499494 *
500495 * Throws if `decimalPlaces` or `roundingMode` is invalid.
501496 *
@@ -524,11 +519,10 @@ export declare class BigNumber implements BigNumber.Instance {
524519 * Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode
525520 * `roundingMode` to a maximum of `decimalPlaces` decimal places.
526521 *
527- * If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of
528- * decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is
529- * ±`Infinity` or `NaN`.
522+ * If `decimalPlaces` is omitted, the return value is the number of decimal places of the value of
523+ * this BigNumber, or `null` if the value of this BigNumber is ±`Infinity` or `NaN`.
530524 *
531- * If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
525+ * If `roundingMode` is omitted, `ROUNDING_MODE` is used.
532526 *
533527 * Throws if `decimalPlaces` or `roundingMode` is invalid.
534528 *
@@ -693,7 +687,7 @@ export declare class BigNumber implements BigNumber.Instance {
693687 * Returns a BigNumber whose value is the value of this BigNumber rounded to an integer using
694688 * rounding mode `rm`.
695689 *
696- * If `rm` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
690+ * If `rm` is omitted, `ROUNDING_MODE` is used.
697691 *
698692 * Throws if `rm` is invalid.
699693 *
@@ -790,7 +784,7 @@ export declare class BigNumber implements BigNumber.Instance {
790784 * returns `false`.
791785 *
792786 * ```ts
793- * 0.1 > (0.3 - 0 // true
787+ * 0.1 > (0.3 - 0.2) // true
794788 * x = new BigNumber(0.1)
795789 * x.gt(BigNumber(0.3).minus(0.2)) // false
796790 * BigNumber(0).gt(x) // false
@@ -1122,7 +1116,7 @@ export declare class BigNumber implements BigNumber.Instance {
11221116 * Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of
11231117 * `significantDigits` significant digits using rounding mode `roundingMode`.
11241118 *
1125- * If `roundingMode` is omitted or is `null` or `undefined` , `ROUNDING_MODE` will be used.
1119+ * If `roundingMode` is omitted, `ROUNDING_MODE` will be used.
11261120 *
11271121 * Throws if `significantDigits` or `roundingMode` is invalid.
11281122 *
@@ -1166,7 +1160,7 @@ export declare class BigNumber implements BigNumber.Instance {
11661160 * Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of
11671161 * `significantDigits` significant digits using rounding mode `roundingMode`.
11681162 *
1169- * If `roundingMode` is omitted or is `null` or `undefined` , `ROUNDING_MODE` will be used.
1163+ * If `roundingMode` is omitted, `ROUNDING_MODE` will be used.
11701164 *
11711165 * Throws if `significantDigits` or `roundingMode` is invalid.
11721166 *
@@ -1244,11 +1238,10 @@ export declare class BigNumber implements BigNumber.Instance {
12441238 * If the value of this BigNumber in exponential notation has fewer than `decimalPlaces` fraction
12451239 * digits, the return value will be appended with zeros accordingly.
12461240 *
1247- * If `decimalPlaces` is omitted, or is `null` or `undefined`, the number of digits after the
1248- * decimal point defaults to the minimum number of digits necessary to represent the value
1249- * exactly.
1241+ * If `decimalPlaces` is omitted, the number of digits after the decimal point defaults to the
1242+ * minimum number of digits necessary to represent the value exactly.
12501243 *
1251- * If `roundingMode` is omitted or is `null` or `undefined` , `ROUNDING_MODE` is used.
1244+ * If `roundingMode` is omitted, `ROUNDING_MODE` is used.
12521245 *
12531246 * Throws if `decimalPlaces` or `roundingMode` is invalid.
12541247 *
@@ -1282,12 +1275,12 @@ export declare class BigNumber implements BigNumber.Instance {
12821275 * Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or
12831276 * equal to 10**21, this method will always return normal notation.
12841277 *
1285- * If `decimalPlaces` is omitted or is `null` or `undefined` , the return value will be unrounded
1286- * and in normal notation. This is also unlike `Number.prototype.toFixed`, which returns the value
1287- * to zero decimal places. It is useful when normal notation is required and the current
1288- * `EXPONENTIAL_AT` setting causes ` toString` to return exponential notation.
1278+ * If `decimalPlaces` is omitted, the return value will be unrounded and in normal notation.
1279+ * This is also unlike `Number.prototype.toFixed`, which returns the value to zero decimal places.
1280+ * It is useful when normal notation is required and the current `EXPONENTIAL_AT` setting causes
1281+ * `toString` to return exponential notation.
12891282 *
1290- * If `roundingMode` is omitted or is `null` or `undefined` , `ROUNDING_MODE` is used.
1283+ * If `roundingMode` is omitted, `ROUNDING_MODE` is used.
12911284 *
12921285 * Throws if `decimalPlaces` or `roundingMode` is invalid.
12931286 *
@@ -1317,12 +1310,12 @@ export declare class BigNumber implements BigNumber.Instance {
13171310 *
13181311 * The formatting object may contain some or all of the properties shown in the examples below.
13191312 *
1320- * If `decimalPlaces` is omitted or is `null` or `undefined` , then the return value is not
1321- * rounded to a fixed number of decimal places.
1313+ * If `decimalPlaces` is omitted, then the return value is not rounded to a fixed number of
1314+ * decimal places.
13221315 *
1323- * If `roundingMode` is omitted or is `null` or `undefined` , `ROUNDING_MODE` is used.
1316+ * If `roundingMode` is omitted, `ROUNDING_MODE` is used.
13241317 *
1325- * If `format` is omitted or is `null` or `undefined` , `FORMAT` is used.
1318+ * If `format` is omitted, `FORMAT` is used.
13261319 *
13271320 * Throws if `decimalPlaces`, `roundingMode`, or `format` is invalid.
13281321 *
@@ -1378,8 +1371,8 @@ export declare class BigNumber implements BigNumber.Instance {
13781371 * Returns an array of two BigNumbers representing the value of this BigNumber as a simple
13791372 * fraction with an integer numerator and an integer denominator.
13801373 * The denominator will be a positive non-zero value less than or equal to `max_denominator`.
1381- * If a maximum denominator, `max_denominator`, is not specified, or is `null` or `undefined`, the
1382- * denominator will be the lowest value necessary to represent the number exactly.
1374+ * If a maximum denominator, `max_denominator`, is not specified, the denominator will be the
1375+ * lowest value necessary to represent the number exactly.
13831376 *
13841377 * Throws if `max_denominator` is invalid.
13851378 *
@@ -1430,10 +1423,9 @@ export declare class BigNumber implements BigNumber.Instance {
14301423 * If `significantDigits` is less than the number of digits necessary to represent the integer
14311424 * part of the value in normal (fixed-point) notation, then exponential notation is used.
14321425 *
1433- * If `significantDigits` is omitted, or is `null` or `undefined`, then the return value is the
1434- * same as `n.toString()`.
1426+ * If `significantDigits` is omitted, then the return value is the same as `n.toString()`.
14351427 *
1436- * If `roundingMode` is omitted or is `null` or `undefined` , `ROUNDING_MODE` is used.
1428+ * If `roundingMode` is omitted, `ROUNDING_MODE` is used.
14371429 *
14381430 * Throws if `significantDigits` or `roundingMode` is invalid.
14391431 *
@@ -1458,7 +1450,7 @@ export declare class BigNumber implements BigNumber.Instance {
14581450
14591451 /**
14601452 * Returns a string representing the value of this BigNumber in base `base`, or base 10 if `base`
1461- * is omitted or is `null` or `undefined` .
1453+ * is omitted.
14621454 *
14631455 * For bases above 10, and using the default base conversion alphabet (see `ALPHABET`), values
14641456 * from 10 to 35 are represented by a-z (the same as `Number.prototype.toString`).
@@ -1471,8 +1463,6 @@ export declare class BigNumber implements BigNumber.Instance {
14711463 * exponent equal to or less than the negative component of the setting, then exponential notation
14721464 * is returned.
14731465 *
1474- * If `base` is `null` or `undefined` it is ignored.
1475- *
14761466 * Throws if `base` is invalid.
14771467 *
14781468 * ```ts
@@ -1592,7 +1582,7 @@ export declare class BigNumber implements BigNumber.Instance {
15921582
15931583 /**
15941584 * Returns a new independent BigNumber constructor with configuration as described by `object`, or
1595- * with the default configuration if object is `null` or `undefined` .
1585+ * with the default configuration if object is omitted .
15961586 *
15971587 * Throws if `object` is not an object.
15981588 *
@@ -1828,4 +1818,4 @@ export declare class BigNumber implements BigNumber.Instance {
18281818 static set ( object ?: BigNumber . Config ) : BigNumber . Config ;
18291819}
18301820
1831- export function BigNumber ( n : BigNumber . Value , base ?: number ) : BigNumber ;
1821+ declare function BigNumber ( n : BigNumber . Value , base ?: number ) : BigNumber ;
0 commit comments