add missing toJSON field to bigints inside artigen's worker

This commit is contained in:
Ean Milligan 2025-07-09 14:42:10 -04:00
parent 515021a295
commit cb5522345a
1 changed files with 9 additions and 0 deletions

View File

@ -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');