Skip to content

Commit

Permalink
Configure tsc to emit jsbi.d.ts (#90)
Browse files Browse the repository at this point in the history
Fixes #89.
  • Loading branch information
mathiasbynens authored Apr 13, 2022
1 parent 374313c commit 7dee7e7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 44 deletions.
85 changes: 42 additions & 43 deletions jsbi.d.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
export default class JSBI {
private constructor(length: number, sign: boolean);
private length: number;
private sign: boolean;

static BigInt(from: number|string|boolean|object): JSBI;

toString(radix?: number): string;
static toNumber(x: JSBI): number;

static unaryMinus(x: JSBI): JSBI;
static bitwiseNot(x: JSBI): JSBI;

static exponentiate(x: JSBI, y: JSBI): JSBI;
static multiply(x: JSBI, y: JSBI): JSBI;
static divide(x: JSBI, y: JSBI): JSBI;
static remainder(x: JSBI, y: JSBI): JSBI;
static add(x: JSBI, y: JSBI): JSBI;
static subtract(x: JSBI, y: JSBI): JSBI;
static leftShift(x: JSBI, y: JSBI): JSBI;
static signedRightShift(x: JSBI, y: JSBI): JSBI;

static lessThan(x: JSBI, y: JSBI): boolean;
static lessThanOrEqual(x: JSBI, y: JSBI): boolean;
static greaterThan(x: JSBI, y: JSBI): boolean;
static greaterThanOrEqual(x: JSBI, y: JSBI): boolean;
static equal(x: JSBI, y: JSBI): boolean;
static notEqual(x: JSBI, y: JSBI): boolean;

static bitwiseAnd(x: JSBI, y: JSBI): JSBI;
static bitwiseXor(x: JSBI, y: JSBI): JSBI;
static bitwiseOr(x: JSBI, y: JSBI): JSBI;

static asIntN(n: number, x: JSBI): JSBI;
static asUintN(n: number, x: JSBI): JSBI;

static ADD(x: any, y: any): any;
static LT(x: any, y: any): boolean;
static LE(x: any, y: any): boolean;
static GT(x: any, y: any): boolean;
static GE(x: any, y: any): boolean;
static EQ(x: any, y: any): boolean;
static NE(x: any, y: any): boolean;
declare class JSBI extends Array {
private sign;
constructor(length: number, sign: boolean);
static BigInt(arg: number | string | boolean | object): JSBI;
toDebugString(): string;
toString(radix?: number): string;
valueOf(): void;
static toNumber(x: JSBI): number;
static unaryMinus(x: JSBI): JSBI;
static bitwiseNot(x: JSBI): JSBI;
static exponentiate(x: JSBI, y: JSBI): JSBI;
static multiply(x: JSBI, y: JSBI): JSBI;
static divide(x: JSBI, y: JSBI): JSBI;
static remainder(x: JSBI, y: JSBI): JSBI;
static add(x: JSBI, y: JSBI): JSBI;
static subtract(x: JSBI, y: JSBI): JSBI;
static leftShift(x: JSBI, y: JSBI): JSBI;
static signedRightShift(x: JSBI, y: JSBI): JSBI;
static unsignedRightShift(): void;
static lessThan(x: JSBI, y: JSBI): boolean;
static lessThanOrEqual(x: JSBI, y: JSBI): boolean;
static greaterThan(x: JSBI, y: JSBI): boolean;
static greaterThanOrEqual(x: JSBI, y: JSBI): boolean;
static equal(x: JSBI, y: JSBI): boolean;
static notEqual(x: JSBI, y: JSBI): boolean;
static bitwiseAnd(x: JSBI, y: JSBI): JSBI;
static bitwiseXor(x: JSBI, y: JSBI): JSBI;
static bitwiseOr(x: JSBI, y: JSBI): JSBI;
static asIntN(n: number, x: JSBI): JSBI;
static asUintN(n: number, x: JSBI): JSBI;
static ADD(x: any, y: any): string | number | JSBI;
static LT(x: any, y: any): boolean;
static LE(x: any, y: any): boolean;
static GT(x: any, y: any): boolean;
static GE(x: any, y: any): boolean;
static EQ(x: any, y: any): boolean;
static NE(x: any, y: any): boolean;
static DataViewGetBigInt64(dataview: DataView, byteOffset: number, littleEndian?: boolean): JSBI;
static DataViewGetBigUint64(dataview: DataView, byteOffset: number, littleEndian?: boolean): JSBI;
static DataViewSetBigInt64(dataview: DataView, byteOffset: number, value: JSBI, littleEndian?: boolean): void;
static DataViewSetBigUint64(dataview: DataView, byteOffset: number, value: JSBI, littleEndian?: boolean): void;
}
export default JSBI;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"jsbi.d.ts"
],
"scripts": {
"build": "tsc && for f in tsc-out/*.js; do mv -- \"$f\" \"${f%.js}.mjs\"; done && rollup --config rollup.config.js",
"build": "tsc && for f in tsc-out/*.js; do mv -- \"$f\" \"${f%.js}.mjs\"; done && sed -e '/__absoluteDivLarge/,+4d' tsc-out/jsbi.d.ts | grep -v ' __' > jsbi.d.ts && rollup --config rollup.config.js",
"dev": "tsc --watch",
"test": "set -e; for file in tests/*.mjs; do node --no-warnings --experimental-modules --experimental-specifier-resolution=node --loader ./tests/resolve.source.mjs \"${file}\"; done; for file in benchmarks/*.mjs; do node --no-warnings --experimental-modules --experimental-specifier-resolution=node --loader ./tests/resolve.source.mjs \"${file}\"; done",
"pretest": "npm run build",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"declaration": true,
"downlevelIteration": true,
"importHelpers": false,
"inlineSources": false,
Expand Down

0 comments on commit 7dee7e7

Please sign in to comment.