Skip to content

docs(lib): add @throws JSDoc for BigInt methods and constructor #61653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/lib/es2020.bigint.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ interface BigInt {
/**
* Returns a string representation of an object.
* @param radix Specifies a radix for converting numeric values to strings.
* @throws {RangeError} If `radix` is less than 2 or greater than 36.
*/
toString(radix?: number): string;

Expand All @@ -103,6 +104,14 @@ interface BigInt {
}

interface BigIntConstructor {
/**
* Creates a BigInt value from a number, string, boolean, or another BigInt.
*
* @param value The value to convert to a BigInt.
* @throws {RangeError} If `value` is a non-integer number.
* @throws {TypeError} If `value` cannot be converted to a primitive, or if the primitive is undefined, null, or a symbol.
* @throws {SyntaxError} If `value` is a string that cannot be parsed as a BigInt.
*/
(value: bigint | boolean | number | string): bigint;
readonly prototype: BigInt;

Expand All @@ -111,13 +120,15 @@ interface BigIntConstructor {
* All higher bits are discarded.
* @param bits The number of low bits to use
* @param int The BigInt whose bits to extract
* @throws {RangeError} If `bits` is negative or greater than 2 ** 53 - 1.
*/
asIntN(bits: number, int: bigint): bigint;
/**
* Interprets the low bits of a BigInt as an unsigned integer.
* All higher bits are discarded.
* @param bits The number of low bits to use
* @param int The BigInt whose bits to extract
* @throws {RangeError} If `bits` is negative or greater than 2 ** 53 - 1.
*/
asUintN(bits: number, int: bigint): bigint;
}
Expand Down