diff --git a/long/long-tests.ts b/long/long-tests.ts index 928cc9453..f70835f66 100644 --- a/long/long-tests.ts +++ b/long/long-tests.ts @@ -2,7 +2,7 @@ import Long = require("long"); -var val: Long; +var val: dcodeIO.Long; var n: number = 42; var b: boolean = true; var s: string = "1337"; diff --git a/long/long.d.ts b/long/long.d.ts index 5c3704a81..32d773b9d 100644 --- a/long/long.d.ts +++ b/long/long.d.ts @@ -3,70 +3,73 @@ // Definitions by: Peter Kooijmans // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "long" { +declare module dcodeIO { + interface LongStatic { + new (low: number, high?: number, unsigned?: boolean): Long; - module Long { - export var MAX_UNSIGNED_VALUE: Long; - export var MAX_VALUE: Long; - export var MIN_VALUE: Long; - export var NEG_ONE: Long; - export var ONE: Long; - export var UONE: Long; - export var UZERO: Long; - export var ZERO: Long; + MAX_UNSIGNED_VALUE: Long; + MAX_VALUE: Long; + MIN_VALUE: Long; + NEG_ONE: Long; + ONE: Long; + UONE: Long; + UZERO: Long; + ZERO: Long; - export function fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; - export function fromInt(value: number, unsigned?: boolean): Long; - export function fromNumber(value: number, unsigned?: boolean): Long; - export function fromString(str: string, unsigned?: boolean | number, radix?: number): Long; - export function fromValue(val: Long | number | string): Long; + fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; + fromInt(value: number, unsigned?: boolean): Long; + fromNumber(value: number, unsigned?: boolean): Long; + fromString(str: string, unsigned?: boolean | number, radix?: number): Long; + fromValue(val: Long | number | string): Long; + isLong(obj: any): boolean; + } - export function isLong(obj: any): boolean; - } + interface Long { + high: number; + low: number; + unsigned: boolean; - class Long { - high: number; - low: number; - unsigned :boolean; + add(other: Long | number | string): Long; + and(other: Long | number | string): Long; + compare(other: Long | number | string): number; + div(divisor: Long | number | string): Long; + equals(other: Long | number | string): boolean; + getHighBits(): number; + getHighBitsUnsigned(): number; + getLowBits(): number; + getLowBitsUnsigned(): number; + getNumBitsAbs(): number; + greaterThan(other: Long | number | string): boolean; + greaterThanOrEqual(other: Long | number | string): boolean; + isEven(): boolean; + isNegative(): boolean; + isOdd(): boolean; + isPositive(): boolean; + isZero(): boolean; + lessThan(other: Long | number | string): boolean; + lessThanOrEqual(other: Long | number | string): boolean; + modulo(divisor: Long | number | string): Long; + multiply(multiplier: Long | number | string): Long; + negate(): Long; + not(): Long; + notEquals(other: Long | number | string): boolean; + or(other: Long | number | string): Long; + shiftLeft(numBits: number | Long): Long; + shiftRight(numBits: number | Long): Long; + shiftRightUnsigned(numBits: number | Long): Long; + subtract(other: Long | number | string): Long; + toInt(): number; + toNumber(): number; + toSigned(): Long; + toString(radix?: number): string; + toUnsigned(): Long; + xor(other: Long | number | string): Long; + } - constructor(low: number, high?: number, unsigned?:boolean); - - add(other: Long | number | string): Long; - and(other: Long | number | string): Long; - compare(other: Long | number | string): number; - div(divisor: Long | number | string): Long; - equals(other: Long | number | string): boolean; - getHighBits(): number; - getHighBitsUnsigned(): number; - getLowBits(): number; - getLowBitsUnsigned(): number; - getNumBitsAbs(): number; - greaterThan(other: Long | number | string): boolean; - greaterThanOrEqual(other: Long | number | string): boolean; - isEven(): boolean; - isNegative(): boolean; - isOdd(): boolean; - isPositive(): boolean; - isZero(): boolean; - lessThan(other: Long | number | string): boolean; - lessThanOrEqual(other: Long | number | string): boolean; - modulo(divisor: Long | number | string): Long; - multiply(multiplier: Long | number | string): Long; - negate(): Long; - not(): Long; - notEquals(other: Long | number | string): boolean; - or(other: Long | number | string): Long; - shiftLeft(numBits: number | Long): Long; - shiftRight(numBits: number | Long): Long; - shiftRightUnsigned(numBits: number | Long): Long; - subtract(other: Long | number | string): Long; - toInt(): number; - toNumber(): number; - toSigned(): Long; - toString(radix?: number): string; - toUnsigned(): Long; - xor(other: Long | number | string): Long; - } - - export = Long; + export var Long: LongStatic; } + +declare module "long" { + var Long: dcodeIO.LongStatic; + export = Long; +} \ No newline at end of file