Skip to content
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

fix(algolia): fix getAlgoliaResults typings #336

Merged
merged 1 commit into from
Oct 12, 2020

Conversation

francoischalifour
Copy link
Member

This fixes some wrong types in the getAlgoliaResults function. We now make sure to receive records as inputs and to return hits (being their returned value with highlighting and snippetting).

This fixes some wrong types in the `getAlgoliaResults` function. We now make sure to receive records as inputs and to return hits (being their returned value with highlighting and snipetting).
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a2200cf:

Sandbox Source
algolia/autocomplete.js: js Configuration

@@ -2,11 +2,11 @@ import { Hit } from '@algolia/client-search';

import { search, SearchParams } from './search';

export function getAlgoliaHits<THit>({
export function getAlgoliaHits<TRecord>({
Copy link
Contributor

Choose a reason for hiding this comment

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

what happened to the idea of making this an indexName indexed object of records? The client doesn't have the feature, but I think we could assert the type here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it makes more sense to implement this type mapping in the client first, and then to leverage that in Autocomplete. It'll avoid shipping any inconsistencies.

(The more I work on multi-index UIs with the search client, the more I need this type support btw 🙂)

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

changes look alright!

@francoischalifour francoischalifour merged commit 0559624 into next Oct 12, 2020
@francoischalifour francoischalifour deleted the fix/getAlgoliaResults-types branch October 12, 2020 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants