fix(types): use collection field in UnionSearchResponseRequestParams#350
Open
rachit367 wants to merge 1 commit into
Open
fix(types): use collection field in UnionSearchResponseRequestParams#350rachit367 wants to merge 1 commit into
rachit367 wants to merge 1 commit into
Conversation
Collaborator
|
Which version of Typesense was this tested on? A PR to return This has been the case for all major Typesense versions after 29.0. |
tharropoulos
requested changes
May 19, 2026
tharropoulos
left a comment
Collaborator
There was a problem hiding this comment.
Please leave a TODO comment underneath the collection prop, we should deprecate this.
|
|
||
| export interface UnionSearchResponseRequestParams | ||
| extends AllRequiredBut<SearchResponseRequestParams, "voice_query"> { | ||
| extends Omit< |
Collaborator
There was a problem hiding this comment.
Maybe remove the omit, keep it as an optional prop and add collection as optional as well
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #321.
UnionSearchResponseRequestParamsextendsSearchResponseRequestParams, which declarescollection_name?: string. But for a union multi-search, the server returns the per-search entry underunion_request_paramswith the field namedcollection(matching the field name used in the request), notcollection_name. The current type forces callers to widen or cast every time they readunion_request_params[i].collection.Override the field on the union variant: omit
collection_namefrom the inherited shape and addcollection: string. RegularSearchResponseRequestParams(used bySearchResponse.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.