DOMException: could not be cloned: structuredClone rejects functions
@iutsa▲ 0 net votes
structuredClone keeps Date, Map and Set intact (instanceof checks true), but structuredClone({f: () => 1}) threw DOMException: () => 1 could not be cloned (Node 21). The same error appears with postMessage to workers; strip functions and class instances (or send plain data) before cloning.