|
1 |
| -// Type definitions for Long.js 1.1.2 |
| 1 | +// Type definitions for Long.js v2.2.5 |
2 | 2 | // Project: https://github.com/dcodeIO/Long.js
|
3 |
| -// Definitions by: Toshihide Hara <https://github.com/kerug/> |
| 3 | +// Definitions by: Peter Kooijmans <https://github.com/peterkooijmans/> |
4 | 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
|
5 | 5 |
|
6 |
| -declare module dcodeIO { |
| 6 | +declare module "long" { |
7 | 7 |
|
8 |
| - interface LongStatic { |
9 |
| - new(low:number, high:number, unsigned?:boolean):Long; |
| 8 | + module Long { |
| 9 | + export var MAX_UNSIGNED_VALUE: Long; |
| 10 | + export var MAX_VALUE: Long; |
| 11 | + export var MIN_VALUE: Long; |
| 12 | + export var NEG_ONE: Long; |
| 13 | + export var ONE: Long; |
| 14 | + export var UONE: Long; |
| 15 | + export var UZERO: Long; |
| 16 | + export var ZERO: Long; |
10 | 17 |
|
11 |
| - MAX_SIGNED_VALUE:Long; |
12 |
| - MAX_UNSIGNED_VALUE:Long; |
13 |
| - MAX_VALUE:Long; |
14 |
| - MIN_SIGNED_VALUE:Long; |
15 |
| - MIN_UNSIGNED_VALUE:Long; |
16 |
| - MIN_VALUE:Long; |
17 |
| - NEG_ONE:Long; |
18 |
| - ONE:Long; |
19 |
| - ZERO:Long; |
| 18 | + export function fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; |
| 19 | + export function fromInt(value: number, unsigned?: boolean): Long; |
| 20 | + export function fromNumber(value: number, unsigned?: boolean): Long; |
| 21 | + export function fromString(str: string, unsigned?: boolean | number, radix?: number): Long; |
| 22 | + export function fromValue(val: Long | number | string): Long; |
20 | 23 |
|
21 |
| - from28Bits(part0:number, part1:number, part2:number, unsigned?:boolean):Long; |
22 |
| - fromBits(lowBits:number, highBits:number, unsigned?:boolean):Long; |
23 |
| - fromInt(value:number, unsigned?:boolean):Long; |
24 |
| - fromNumber(value:number, unsigned?:boolean):Long; |
25 |
| - fromString(str:string, unsigned?:boolean, radix?:number):Long; |
26 |
| - fromString(str:string, unsigned?:number, radix?:number):Long; |
27 |
| - fromString(str:string, unsigned?:any, radix?:number):Long; |
28 |
| - } |
| 24 | + export function isLong(obj: any): boolean; |
| 25 | + } |
29 | 26 |
|
30 |
| - interface Long { |
31 |
| - high:number; |
32 |
| - low:number; |
33 |
| - unsigned:boolean; |
| 27 | + class Long { |
| 28 | + high: number; |
| 29 | + low: number; |
| 30 | + unsigned :boolean; |
34 | 31 |
|
35 |
| - add(other:Long):Long; |
36 |
| - and(other:Long):Long; |
37 |
| - clone():Long; |
38 |
| - compare(other:Long):number; |
39 |
| - div(other:Long):Long; |
40 |
| - equals(other:Long):boolean; |
41 |
| - getHighBits():number; |
42 |
| - getHighBitsUnsigned():number; |
43 |
| - getLowBits():number; |
44 |
| - getLowBitsUnsigned():number; |
45 |
| - getNumBitsAbs():number; |
46 |
| - greaterThan(other:Long):boolean; |
47 |
| - greaterThanOrEqual(other:Long):boolean; |
48 |
| - isEven():boolean; |
49 |
| - isNegative():boolean; |
50 |
| - isOdd():boolean; |
51 |
| - isZero():boolean; |
52 |
| - lessThan(other:Long):boolean; |
53 |
| - lessThanOrEqual(other:Long):boolean; |
54 |
| - modulo(other:Long):Long; |
55 |
| - multiply(other:Long):Long; |
56 |
| - negate():Long; |
57 |
| - not():Long; |
58 |
| - notEquals(other:Long):boolean; |
59 |
| - or(other:Long):Long; |
60 |
| - shiftLeft(numBits:number):Long; |
61 |
| - shiftRight(numBits:number):Long; |
62 |
| - shiftRightUnsigned(numBits:number):Long; |
63 |
| - subtract(other:Long):Long; |
64 |
| - toInt():number; |
65 |
| - toNumber():number; |
66 |
| - toSigned():Long; |
67 |
| - toString(radix?:number):string; |
68 |
| - toUnsigned():Long; |
69 |
| - xor(other:Long):Long; |
70 |
| - } |
| 32 | + constructor(low: number, high?: number, unsigned?:boolean); |
71 | 33 |
|
72 |
| - // for browser |
73 |
| - export var Long:LongStatic; |
74 |
| -} |
| 34 | + add(other: Long | number | string): Long; |
| 35 | + and(other: Long | number | string): Long; |
| 36 | + compare(other: Long | number | string): number; |
| 37 | + div(divisor: Long | number | string): Long; |
| 38 | + equals(other: Long | number | string): boolean; |
| 39 | + getHighBits(): number; |
| 40 | + getHighBitsUnsigned(): number; |
| 41 | + getLowBits(): number; |
| 42 | + getLowBitsUnsigned(): number; |
| 43 | + getNumBitsAbs(): number; |
| 44 | + greaterThan(other: Long | number | string): boolean; |
| 45 | + greaterThanOrEqual(other: Long | number | string): boolean; |
| 46 | + isEven(): boolean; |
| 47 | + isNegative(): boolean; |
| 48 | + isOdd(): boolean; |
| 49 | + isPositive(): boolean; |
| 50 | + isZero(): boolean; |
| 51 | + lessThan(other: Long | number | string): boolean; |
| 52 | + lessThanOrEqual(other: Long | number | string): boolean; |
| 53 | + modulo(divisor: Long | number | string): Long; |
| 54 | + multiply(multiplier: Long | number | string): Long; |
| 55 | + negate(): Long; |
| 56 | + not(): Long; |
| 57 | + notEquals(other: Long | number | string): boolean; |
| 58 | + or(other: Long | number | string): Long; |
| 59 | + shiftLeft(numBits: number | Long): Long; |
| 60 | + shiftRight(numBits: number | Long): Long; |
| 61 | + shiftRightUnsigned(numBits: number | Long): Long; |
| 62 | + subtract(other: Long | number | string): Long; |
| 63 | + toInt(): number; |
| 64 | + toNumber(): number; |
| 65 | + toSigned(): Long; |
| 66 | + toString(radix?: number): string; |
| 67 | + toUnsigned(): Long; |
| 68 | + xor(other: Long | number | string): Long; |
| 69 | + } |
75 | 70 |
|
76 |
| -// for node, commonjs |
77 |
| -declare module "long" { |
78 |
| - var Long:dcodeIO.LongStatic; |
79 |
| - export = Long; |
| 71 | + export = Long; |
80 | 72 | }
|
0 commit comments