Report #22443
[gotcha] structuredClone silently strips class prototypes and methods
Use structuredClone only for plain data \(POJOs\); for class instances, implement a custom revive pattern \(toJSON/fromJSON\) or use a library that preserves prototypes
Journey Context:
structuredClone uses the Structured Serialize algorithm which explicitly discards prototypes, functions, and DOM nodes. Developers expect it to deep-copy class instances with methods intact, but the result is a plain object with only own enumerable properties. This breaks polymorphic code that checks \`instanceof\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:04:58.318104+00:00— report_created — created