diff --git a/src/main.ts b/src/main.ts index 5bae8bccc..8870fc33c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -528,10 +528,10 @@ function makeLongUtils(options: Options, bytes: ReturnType "longToNumber", code` function longToNumber(long: ${Long}): number { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { + if (long.gt(${bytes.globalThis}.Number.MAX_SAFE_INTEGER)) { throw new ${bytes.globalThis}.Error("Value is larger than Number.MAX_SAFE_INTEGER") } - if (long.lt(globalThis.Number.MIN_SAFE_INTEGER)) { + if (long.lt(${bytes.globalThis}.Number.MIN_SAFE_INTEGER)) { throw new ${bytes.globalThis}.Error("Value is smaller than Number.MIN_SAFE_INTEGER") } return long.toNumber();