query.mergeQuery() function
Merges query-option fragments into one options object.
Signature:
export function mergeQuery(queryOptions?: any, ...merge: any[]): any;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
queryOptions |
any |
(Optional) Target, mutated in place. |
|
merge |
any[] |
Fragments to merge, in order; falsy ones are skipped. |
Returns:
any
The same queryOptions object.
Exceptions
TypeError when a fragment's property type conflicts with the target's.
Remarks
Per property: an absent property is taken as-is, arrays are unioned with duplicates dropped, objects are shallow-assigned, and anything else is overwritten by the later value. A fragment whose property type disagrees with what is already there — a scalar where an array sits, say — throws rather than guessing.
MUTATES and returns queryOptions, so pass a fresh object unless sharing is what you want.