From cb5522345ae02668de6e78f1b2ea2d4679514c56 Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Wed, 9 Jul 2025 14:42:10 -0400 Subject: [PATCH] add missing toJSON field to bigints inside artigen's worker --- src/artigen/managers/artigenWorker.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/artigen/managers/artigenWorker.ts b/src/artigen/managers/artigenWorker.ts index b69bcc3..2c5e2ac 100644 --- a/src/artigen/managers/artigenWorker.ts +++ b/src/artigen/managers/artigenWorker.ts @@ -8,6 +8,15 @@ import { loggingEnabled } from 'artigen/utils/logFlag.ts'; loggingEnabled && initLog('logs/worker', loggingEnabled); +// Extend the BigInt prototype to support JSON.stringify +interface BigIntX extends BigInt { + // Convert to BigInt to string form in JSON.stringify + toJSON: () => string; +} +(BigInt.prototype as BigIntX).toJSON = function () { + return this.toString(); +}; + // Alert rollQueue that this worker is ready self.postMessage('ready');