From 27958001a7042ab446a2ca2739539414d7ef875a Mon Sep 17 00:00:00 2001 From: JOOHOJANG Date: Fri, 8 Nov 2024 12:45:56 +0900 Subject: [PATCH] Remove int64max --- packages/sdk/src/document/time/version_vector.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/sdk/src/document/time/version_vector.ts b/packages/sdk/src/document/time/version_vector.ts index 7e2fc8d71..d777c8a79 100644 --- a/packages/sdk/src/document/time/version_vector.ts +++ b/packages/sdk/src/document/time/version_vector.ts @@ -61,21 +61,18 @@ export class VersionVector { /** * `minLamport` returns min lamport value from vector */ - public minLamport() { + public minLamport(): bigint { if (this.vector.size === 0) { return BigInt(0); } - // 2^63-1 - let min = 9223372036854775807n; - + let min: bigint | undefined; for (const [, lamport] of this) { - if (lamport < min) { + if (min === undefined || lamport < min) { min = lamport; } } - - return min; + return min as bigint; } /**