JSON.stringify with a guard against accidentally serializing class instances.
The default JSON.stringify walks every own-enumerable string-keyed property,
which means TS-private fields (which are runtime-public, only the type
system hides them), class fields, and other instance state can leak into
the wire response.
safeStringify throws on any class instance — only plain objects, arrays,
and primitives reach the wire.
JSON.stringify with a guard against accidentally serializing class instances.
The default JSON.stringify walks every own-enumerable string-keyed property, which means TS-
privatefields (which are runtime-public, only the type system hides them), class fields, and other instance state can leak into the wire response.safeStringifythrows on any class instance — only plain objects, arrays, and primitives reach the wire.