Skip to content

Commit 997c748

Browse files
committed
#355 Support BigInt argument
1 parent a543ab5 commit 997c748

File tree

1 file changed

+29
-35
lines changed

1 file changed

+29
-35
lines changed

bignumber.d.ts

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ declare namespace BigNumber {
320320
type Constructor = typeof BigNumber;
321321
type ModuloMode = 0 | 1 | 3 | 6 | 9;
322322
type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
323-
type Value = string | number | Instance;
323+
type Value = string | number | bigint | Instance;
324324
}
325325

326326
declare class BigNumber implements BigNumber.Instance {
@@ -339,7 +339,7 @@ declare class BigNumber implements BigNumber.Instance {
339339

340340
/**
341341
* Returns a new instance of a BigNumber object with value `n`, where `n` is a numeric value in
342-
* 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.
343343
*
344344
* ```ts
345345
* x = new BigNumber(123.4567) // '123.4567'
@@ -487,11 +487,10 @@ declare class BigNumber implements BigNumber.Instance {
487487
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode
488488
* `roundingMode` to a maximum of `decimalPlaces` decimal places.
489489
*
490-
* If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of
491-
* decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is
492-
* ±`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`.
493492
*
494-
* If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
493+
* If `roundingMode` is omitted, `ROUNDING_MODE` is used.
495494
*
496495
* Throws if `decimalPlaces` or `roundingMode` is invalid.
497496
*
@@ -520,11 +519,10 @@ declare class BigNumber implements BigNumber.Instance {
520519
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode
521520
* `roundingMode` to a maximum of `decimalPlaces` decimal places.
522521
*
523-
* If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of
524-
* decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is
525-
* ±`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`.
526524
*
527-
* If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
525+
* If `roundingMode` is omitted, `ROUNDING_MODE` is used.
528526
*
529527
* Throws if `decimalPlaces` or `roundingMode` is invalid.
530528
*
@@ -689,7 +687,7 @@ declare class BigNumber implements BigNumber.Instance {
689687
* Returns a BigNumber whose value is the value of this BigNumber rounded to an integer using
690688
* rounding mode `rm`.
691689
*
692-
* If `rm` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
690+
* If `rm` is omitted, `ROUNDING_MODE` is used.
693691
*
694692
* Throws if `rm` is invalid.
695693
*
@@ -1118,7 +1116,7 @@ declare class BigNumber implements BigNumber.Instance {
11181116
* Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of
11191117
* `significantDigits` significant digits using rounding mode `roundingMode`.
11201118
*
1121-
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` will be used.
1119+
* If `roundingMode` is omitted, `ROUNDING_MODE` will be used.
11221120
*
11231121
* Throws if `significantDigits` or `roundingMode` is invalid.
11241122
*
@@ -1162,7 +1160,7 @@ declare class BigNumber implements BigNumber.Instance {
11621160
* Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of
11631161
* `significantDigits` significant digits using rounding mode `roundingMode`.
11641162
*
1165-
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` will be used.
1163+
* If `roundingMode` is omitted, `ROUNDING_MODE` will be used.
11661164
*
11671165
* Throws if `significantDigits` or `roundingMode` is invalid.
11681166
*
@@ -1240,11 +1238,10 @@ declare class BigNumber implements BigNumber.Instance {
12401238
* If the value of this BigNumber in exponential notation has fewer than `decimalPlaces` fraction
12411239
* digits, the return value will be appended with zeros accordingly.
12421240
*
1243-
* If `decimalPlaces` is omitted, or is `null` or `undefined`, the number of digits after the
1244-
* decimal point defaults to the minimum number of digits necessary to represent the value
1245-
* 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.
12461243
*
1247-
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
1244+
* If `roundingMode` is omitted, `ROUNDING_MODE` is used.
12481245
*
12491246
* Throws if `decimalPlaces` or `roundingMode` is invalid.
12501247
*
@@ -1278,12 +1275,12 @@ declare class BigNumber implements BigNumber.Instance {
12781275
* Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or
12791276
* equal to 10**21, this method will always return normal notation.
12801277
*
1281-
* If `decimalPlaces` is omitted or is `null` or `undefined`, the return value will be unrounded
1282-
* and in normal notation. This is also unlike `Number.prototype.toFixed`, which returns the value
1283-
* to zero decimal places. It is useful when normal notation is required and the current
1284-
* `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.
12851282
*
1286-
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
1283+
* If `roundingMode` is omitted, `ROUNDING_MODE` is used.
12871284
*
12881285
* Throws if `decimalPlaces` or `roundingMode` is invalid.
12891286
*
@@ -1313,12 +1310,12 @@ declare class BigNumber implements BigNumber.Instance {
13131310
*
13141311
* The formatting object may contain some or all of the properties shown in the examples below.
13151312
*
1316-
* If `decimalPlaces` is omitted or is `null` or `undefined`, then the return value is not
1317-
* 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.
13181315
*
1319-
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
1316+
* If `roundingMode` is omitted, `ROUNDING_MODE` is used.
13201317
*
1321-
* If `format` is omitted or is `null` or `undefined`, `FORMAT` is used.
1318+
* If `format` is omitted, `FORMAT` is used.
13221319
*
13231320
* Throws if `decimalPlaces`, `roundingMode`, or `format` is invalid.
13241321
*
@@ -1374,8 +1371,8 @@ declare class BigNumber implements BigNumber.Instance {
13741371
* Returns an array of two BigNumbers representing the value of this BigNumber as a simple
13751372
* fraction with an integer numerator and an integer denominator.
13761373
* The denominator will be a positive non-zero value less than or equal to `max_denominator`.
1377-
* If a maximum denominator, `max_denominator`, is not specified, or is `null` or `undefined`, the
1378-
* 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.
13791376
*
13801377
* Throws if `max_denominator` is invalid.
13811378
*
@@ -1426,10 +1423,9 @@ declare class BigNumber implements BigNumber.Instance {
14261423
* If `significantDigits` is less than the number of digits necessary to represent the integer
14271424
* part of the value in normal (fixed-point) notation, then exponential notation is used.
14281425
*
1429-
* If `significantDigits` is omitted, or is `null` or `undefined`, then the return value is the
1430-
* same as `n.toString()`.
1426+
* If `significantDigits` is omitted, then the return value is the same as `n.toString()`.
14311427
*
1432-
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
1428+
* If `roundingMode` is omitted, `ROUNDING_MODE` is used.
14331429
*
14341430
* Throws if `significantDigits` or `roundingMode` is invalid.
14351431
*
@@ -1454,7 +1450,7 @@ declare class BigNumber implements BigNumber.Instance {
14541450

14551451
/**
14561452
* Returns a string representing the value of this BigNumber in base `base`, or base 10 if `base`
1457-
* is omitted or is `null` or `undefined`.
1453+
* is omitted.
14581454
*
14591455
* For bases above 10, and using the default base conversion alphabet (see `ALPHABET`), values
14601456
* from 10 to 35 are represented by a-z (the same as `Number.prototype.toString`).
@@ -1467,8 +1463,6 @@ declare class BigNumber implements BigNumber.Instance {
14671463
* exponent equal to or less than the negative component of the setting, then exponential notation
14681464
* is returned.
14691465
*
1470-
* If `base` is `null` or `undefined` it is ignored.
1471-
*
14721466
* Throws if `base` is invalid.
14731467
*
14741468
* ```ts
@@ -1588,7 +1582,7 @@ declare class BigNumber implements BigNumber.Instance {
15881582

15891583
/**
15901584
* Returns a new independent BigNumber constructor with configuration as described by `object`, or
1591-
* with the default configuration if object is `null` or `undefined`.
1585+
* with the default configuration if object is omitted.
15921586
*
15931587
* Throws if `object` is not an object.
15941588
*

0 commit comments

Comments
 (0)