no-conditional-empty-object-spread
Build conditional properties explicitly instead of spreading an empty-object branch.
Why
An empty-object conditional spread hides whether a property is omitted, which differs from assigning undefined.
Fix
Construct the object explicitly and add the conditional fields only when the original condition holds, preserving evaluation order and ownership.
Examples
declare const includePage: boolean;const query = { limit: 20, ...(includePage ? { page: 1 } : {}) };declare const includePage: boolean;const query: { limit: number; page?: number } = { limit: 20 };if (includePage) query.page = 1;