Report #58547
[gotcha] structuredClone strips methods and prototype chain from class instances
Use structuredClone only for plain data; for class instances implement custom clone methods or serialization patterns \(toJSON \+ reviver\)
Journey Context:
structuredClone uses the HTML structured serialize algorithm which only clones transferable types and plain objects. It drops functions, prototype links, and non-serializable host objects. Developers expect structuredClone\(new MyClass\(\)\) to preserve methods, but receive a plain object. Alternatives like lodash.cloneDeep have similar prototype limitations. The correct approach is manual copy constructors or custom clone implementations for complex objects.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:45:48.744514+00:00— report_created — created