|
| 1 | +// flow-typed signature: 7d695f62b25d736b51c93b05bb31ffd8 |
| 2 | +// flow-typed version: cc44a27e8f/long_v4.x.x/flow_>=v0.104.x |
| 3 | + |
| 4 | +declare module 'long' { |
| 5 | + declare class Long { |
| 6 | + constructor(low: number, high: number, unsigned?: boolean): Long; |
| 7 | + |
| 8 | + // Fields |
| 9 | + low: number; |
| 10 | + high: number; |
| 11 | + unsigned: boolean; |
| 12 | + |
| 13 | + // Methods |
| 14 | + toNumber(): number; |
| 15 | + add(addend: Long | number | string): Long; |
| 16 | + and(other: Long | number | string): Long; |
| 17 | + compare(other: Long | number | string): number; |
| 18 | + comp(other: Long | number | string): number; |
| 19 | + divide(divisor: Long | number | string): Long; |
| 20 | + div(divisor: Long | number | string): Long; |
| 21 | + equals(other: Long | number | string): boolean; |
| 22 | + eq(other: Long | number | string): boolean; |
| 23 | + getHighBits(): number; |
| 24 | + getHighBitsUnsigned(): number; |
| 25 | + getLowBits(): number; |
| 26 | + getLowBitsUnsigned(): number; |
| 27 | + getNumBitsAbs(): number; |
| 28 | + greaterThan(other: Long | number | string): boolean; |
| 29 | + gt(other: Long | number | string): boolean; |
| 30 | + greaterThanOrEqual(other: Long | number | string): boolean; |
| 31 | + gte(other: Long | number | string): boolean; |
| 32 | + ge(other: Long | number | string): boolean; |
| 33 | + isEven(): boolean; |
| 34 | + isNegative(): boolean; |
| 35 | + isOdd(): boolean; |
| 36 | + isPositive(): boolean; |
| 37 | + isZero(): boolean; |
| 38 | + eqz(): boolean; |
| 39 | + lessThan(other: Long | number | string): boolean; |
| 40 | + lt(other: Long | number | string): boolean; |
| 41 | + lessThanOrEqual(other: Long | number | string): boolean; |
| 42 | + lte(other: Long | number | string): boolean; |
| 43 | + le(other: Long | number | string): boolean; |
| 44 | + modulo(divisor: Long | number | string): Long; |
| 45 | + mod(divisor: Long | number | string): Long; |
| 46 | + rem(divisor: Long | number | string): Long; |
| 47 | + multiply(multiplier: Long | number | string): Long; |
| 48 | + mul(multiplier: Long | number | string): Long; |
| 49 | + negate(): Long; |
| 50 | + neg(): Long; |
| 51 | + not(): Long; |
| 52 | + notEquals(other: Long | number | string): boolean; |
| 53 | + neq(other: Long | number | string): boolean; |
| 54 | + ne(other: Long | number | string): boolean; |
| 55 | + or(other: Long | number | string): Long; |
| 56 | + shiftLeft(numBits: Long | number | string): Long; |
| 57 | + shl(numBits: Long | number | string): Long; |
| 58 | + shiftRight(numBits: Long | number | string): Long; |
| 59 | + shr(numBits: Long | number | string): Long; |
| 60 | + shiftRightUnsigned(numBits: Long | number | string): Long; |
| 61 | + shru(numBits: Long | number | string): Long; |
| 62 | + shr_u(numBits: Long | number | string): Long; |
| 63 | + subtract(subtrahend: Long | number | string): Long; |
| 64 | + sub(subtrahend: Long | number | string): Long; |
| 65 | + toBytes(le?: boolean): number[]; |
| 66 | + toBytesLE(): number[]; |
| 67 | + toBytesBE(): number[]; |
| 68 | + toInt(): number; |
| 69 | + toNumber(): number; |
| 70 | + toSigned(): Long; |
| 71 | + // TODO: fix this. Uncommenting will break spreading for some reason... (e.g. {...new Long(1)}) |
| 72 | + // toString(radix?: number): string; |
| 73 | + toUnsigned(): Long; |
| 74 | + xor(other: Long | number | string): Long; |
| 75 | + |
| 76 | + // Constants |
| 77 | + static ZERO: Long; |
| 78 | + static ONE: Long; |
| 79 | + static NEG_ONE: Long; |
| 80 | + static UZERO: Long; |
| 81 | + static UONE: Long; |
| 82 | + static MAX_VALUE: Long; |
| 83 | + static MIN_VALUE: Long; |
| 84 | + static MAX_UNSIGNED_VALUE: Long; |
| 85 | + |
| 86 | + // Static methods |
| 87 | + static isLong(obj: mixed): boolean; |
| 88 | + static fromBits( |
| 89 | + lowBits: number, |
| 90 | + highBits: number, |
| 91 | + unsigned?: boolean |
| 92 | + ): Long; |
| 93 | + static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long; |
| 94 | + static fromBytesLE(bytes: number[], unsigned?: boolean): Long; |
| 95 | + static fromBytesBE(bytes: number[], unsigned?: boolean): Long; |
| 96 | + static fromInt(value: number, unsigned?: boolean): Long; |
| 97 | + static fromNumber(value: number, unsigned?: boolean): Long; |
| 98 | + static fromString(str: string, unsigned?: boolean, radix?: number): Long; |
| 99 | + static fromString(str: string, radix: number): Long; |
| 100 | + static fromValue(val: mixed, unsigned?: boolean): Long; |
| 101 | + } |
| 102 | + |
| 103 | + declare module.exports: typeof Long |
| 104 | +} |
0 commit comments