perf[ts]: suppress warning of typescript long.ts

This commit is contained in:
godotg
2023-04-14 15:51:25 +08:00
parent eb6e062152
commit 8c8291174c
2 changed files with 6 additions and 9 deletions
@@ -691,11 +691,8 @@ export class Long {
if ((numBits &= 63) === 0) {
return this;
} else if (numBits < 32) {
return Long.fromBits(
this.low << numBits,
(this.high << numBits) | (this.low >>> (32 - numBits)),
this.unsigned
);
const lowNum: number = this.low << numBits;
return Long.fromBits(lowNum, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
} else {
return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
}
@@ -50,12 +50,12 @@ class Longbits {
/**
* Constructs new long bits from the specified number.
*/
static from(value) {
static from(value: any) {
if (typeof value === 'number') {
return Longbits.fromNumber(value);
return Longbits.fromNumber(value as number);
}
if (typeof value === 'string' || value instanceof String) {
value = Long.fromString(value);
value = Long.fromString(value as string);
}
return value.low || value.high ? new Longbits(value.low >>> 0, value.high >>> 0) : zero;
}
@@ -63,7 +63,7 @@ class Longbits {
/**
* Constructs new long bits from the specified number.
*/
static fromNumber(value): Longbits {
static fromNumber(value: number): Longbits {
if (value === 0) {
return zero;
}