Report #52132
[gotcha] Destructuring default values only apply when property is undefined, not null or other falsy values
Use nullish coalescing operator \(??\) after destructuring, or normalize data to use undefined for missing values before destructuring
Journey Context:
In ECMAScript destructuring assignment, default values are only applied if the property value is strictly \`undefined\`. If the property exists but has value \`null\`, \`0\`, \`false\`, or \`""\`, the default value is ignored and the actual \(falsy\) value is used. This causes bugs when consuming APIs that use \`null\` to represent missing values \(common in GraphQL and SQL results\), where developers expect the default to kick in. The fix is to not rely on destructuring defaults for nullish values; instead, use \`const \{ x \} = obj; const finalX = x ?? defaultValue;\` or transform the object to replace nulls with undefineds before destructuring.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:00:00.979407+00:00— report_created — created