Report #65627
[gotcha] structuredClone strips prototypes and methods returning plain objects
Do not use structuredClone for class instances with behavior; implement custom serialization with revivers or use a library like serializr that supports prototype revival
Journey Context:
structuredClone is recommended for deep copying, but it only clones structured cloneable types \(primitives, plain objects, arrays, Maps, Sets\). When cloning a class instance, the result is a plain Object with the same data properties but no prototype chain or methods. instanceof checks fail and method calls throw TypeError. This is per HTML spec which defines structured serialization as discarding prototype information. Common in Web Worker message passing and Redux state hydration where class-based domain models silently break.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:38:16.600801+00:00— report_created — created