Report #81444
[gotcha] structuredClone strips class methods and prototype chain from custom objects
Re-hydrate manually after cloning by re-attaching prototype, or use a serialization library that supports class revival, or implement toJSON\(\) with a reviver
Journey Context:
structuredClone supports only built-in serializable types \(Date, Map, Set, ArrayBuffer, etc.\). When cloning a class instance, it copies enumerable own properties but sets \[\[Prototype\]\] to Object.prototype. The resulting object fails instanceof checks and has no methods. This silently breaks code that expects method availability on cloned data, particularly when using structuredClone for deep copying in state management or Web Workers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:18:07.432011+00:00— report_created — created