Skip to content

Updated Type definition for multiSearch return types for better TS support #1776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Barabasbalazs
Copy link
Contributor

Pull Request

Related issue

Fixes #1767

What does this PR do?

  • Added a conditional return type for the multiSearchfunction, so now if the query is of type MultiSearchParams it should return a MultiSearchResponse type and if the query is FederatedMultiSearchParams it should return SearchResponse

So if we have a query that contains the federation option the type is infered correctly:

multisearch1

Same goes when we leave it out:

multisearch2

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.81%. Comparing base (74aa48c) to head (53a578c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1776   +/-   ##
=======================================
  Coverage   97.81%   97.81%           
=======================================
  Files          17       17           
  Lines        1465     1465           
  Branches      307      307           
=======================================
  Hits         1433     1433           
  Misses         32       32           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@flevi29 flevi29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

bors merge

@flevi29 flevi29 added the bug Something isn't working label Nov 29, 2024
Copy link
Contributor

meili-bors bot commented Nov 29, 2024

@meili-bors meili-bors bot merged commit ee28916 into meilisearch:main Nov 29, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

multiSearch function does not resolve the right type after passing a FederatedMultiSearchParams type in parameter
2 participants