Functional updates drop unrelated symbol properties from plain objects
Author: xu91102Created Sep 26, 2026Updated Sep 26, 2026
Updating a plain object through the functional helpers silently drops its enumerable symbol properties:
const metadata = Symbol('metadata');
const original = { x: 1, [metadata]: 'keep' };
set(original, 'x', 2); // { x: 2 }, expected { x: 2, [metadata]: 'keep' }
remove(original, 'x'); // {}, expected { [metadata]: 'keep' }update has the same behavior. These properties are unrelated to the changed key and should survive the copy, as enumerable string properties do. Reproduced on current main with Node 22.23.2 on macOS. A public-API regression test fails before the fix. Prepared with Codex assistance.
Source: immutable-js/immutable-js