/** * Return a shallow copy of `obj` keeping only the entries whose value is * neither `undefined` nor `null`. * * Used to assemble generated config objects without one conditional spread per * optional field (which would otherwise exceed the lint complexity budget). */ export function compact>(obj: T): Partial { const result: Record = {}; for (const [key, value] of Object.entries(obj)) { if (value !== undefined && value !== null) { result[key] = value; } } return result as Partial; }