-
Beta Was this translation helpful? Give feedback.
Answered by
Haroenv
Sep 5, 2023
Replies: 1 comment 3 replies
-
|
This is actually related to the search client, not InstantSearch, but it's because // algoliasearch v4
import { SearchResponse, MultipleQueriesResponse } from "algoliasearch";
function guardSearchResponse<TObject>(
result: MultipleQueriesResponse<TObject>['results'][number]
): result is SearchResponse<TObject> {
return 'hits' in result;
}// algoliasearch v5
import type { SearchResponse, SearchResult } from 'algoliasearch';
function guardSearchResponse<TObject>(
result: SearchResult
): result is SearchResponse<TObject> {
return 'hits' in result;
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
JSShant
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment



This is actually related to the search client, not InstantSearch, but it's because
resultscould be of typedefaultorfacet, you can cast it:guardSearchResponse(lotResultsQuery.data?.results[0])with