From 8c8291174cdbf015f51774640cdc500590bb1fc0 Mon Sep 17 00:00:00 2001 From: godotg Date: Fri, 14 Apr 2023 15:51:25 +0800 Subject: [PATCH] perf[ts]: suppress warning of typescript long.ts --- protocol/src/main/resources/typescript/buffer/Long.ts | 7 ++----- protocol/src/main/resources/typescript/buffer/Longbits.ts | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/protocol/src/main/resources/typescript/buffer/Long.ts b/protocol/src/main/resources/typescript/buffer/Long.ts index 0276f32e..dac9a00b 100644 --- a/protocol/src/main/resources/typescript/buffer/Long.ts +++ b/protocol/src/main/resources/typescript/buffer/Long.ts @@ -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); } diff --git a/protocol/src/main/resources/typescript/buffer/Longbits.ts b/protocol/src/main/resources/typescript/buffer/Longbits.ts index a3115e58..a538cace 100644 --- a/protocol/src/main/resources/typescript/buffer/Longbits.ts +++ b/protocol/src/main/resources/typescript/buffer/Longbits.ts @@ -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; }