Report #3598
[gotcha] Object.defineProperty defaults writable/enumerable/configurable to false
When using Object.defineProperty, explicitly set writable: true, enumerable: true, and configurable: true in the descriptor unless you specifically want the restricted behavior \(like for private state\).
Journey Context:
Object.defineProperty uses Property Descriptors. According to the spec, if a field is absent from the descriptor, it defaults to false. This is the opposite of normal property assignment \(e.g., \`obj.x = 1\`\), where properties are writable, enumerable, and configurable by default. This leads to 'ghost' properties that don't show up in JSON.stringify, for...in loops, or Object.keys\(\), and cannot be reassigned \(throws in strict mode\). The alternative of using property literals is safer for normal data, but defineProperty is needed for getters/setters or non-enumerable properties. The fix is explicit descriptor flags: \`\{ value: x, writable: true, enumerable: true, configurable: true \}\` for standard data properties.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T17:37:17.993117+00:00— report_created — created