fix(types): use collection field in UnionSearchResponseRequestParams
Fixes #321.
UnionSearchResponseRequestParams extends SearchResponseRequestParams, which declares collection_name?: string. But for a union multi-search, the server returns the per-search entry under union_request_params with the field named collection (matching the field name used in the request), not collection_name. The current type forces callers to widen or cast every time they read union_request_params[i].collection.
Override the field on the union variant: omit collection_name from the inherited shape and add collection: string. Regular SearchResponseRequestParams (used by SearchResponse.request_params) is unchanged.
Confirmed against the response shape from the issue:
{
"union_request_params": [
{ "collection": "collection_one", "first_q": "test", "found": 30, ... }
]
}
No runtime code touched; this is types-only.
Which version of Typesense was this tested on? A PR to return collection_name (to match the rest of the search request responses) was added to Typesense on August 2025: https://github.com/typesense/typesense/pull/2473.
This has been the case for all major Typesense versions after 29.0.