From 9f3f0941d8db69c077c55296f206ab595eb2f48f Mon Sep 17 00:00:00 2001 From: lorefnon Date: Thu, 21 Sep 2023 21:55:26 +0530 Subject: [PATCH] Support bigint in builtin serializer --- src/runtime/browser/helper.jsonStringifyRecursive.ts | 3 +++ src/runtime/nodejs/index.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/runtime/browser/helper.jsonStringifyRecursive.ts b/src/runtime/browser/helper.jsonStringifyRecursive.ts index fbab8d9..9b29942 100644 --- a/src/runtime/browser/helper.jsonStringifyRecursive.ts +++ b/src/runtime/browser/helper.jsonStringifyRecursive.ts @@ -9,6 +9,9 @@ export function jsonStringifyRecursive(obj: unknown) { // Store value in our collection cache.add(value); } + if (typeof value === "bigint") { + return `${value}`; + } return value; }); } diff --git a/src/runtime/nodejs/index.ts b/src/runtime/nodejs/index.ts index 3ec8373..ccd4b18 100644 --- a/src/runtime/nodejs/index.ts +++ b/src/runtime/nodejs/index.ts @@ -165,6 +165,9 @@ export function transportJSON(json: LogObj & ILogObjMeta): void { // Store value in our collection cache.add(value); } + if (typeof value === "bigint") { + return `${value}`; + } return value; }); }