-
|
Hello guys and thanks in advance for your help, I am trying to follow along this code but their is no Typescript example like other part of docs. Here is the error that i am getting I am using the exact same code as the example but i am not able to define the necessary types, woud be great to have Typescript version of example provided as well in the docs. Thank you |
Beta Was this translation helpful? Give feedback.
Answered by
destino92
Mar 2, 2023
Replies: 1 comment
-
|
Solution for anyone that might be having the same issue import { SearchClient } from "algoliasearch/lite";
const customSearchClient: SearchClient = {
...searchClient,
search: (requests) => {
if (requests.every(({ params }) => !params?.query)) {
return Promise.resolve({
results: requests.map(() => ({
hits: [],
nbHits: 0,
nbPages: 0,
page: 0,
processingTimeMS: 0,
hitsPerPage: 0,
exhaustiveNbHits: false,
query: '',
params: '',
})),
});
}
return searchClient.search(requests);
},
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
destino92
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Solution for anyone that might be having the same issue