Module '"algoliasearch/lite"' has no exported member 'SearchClient'.ts(2305)
Line 1:
import type { SearchClient } from 'algoliasearch/lite';
In this file:
https://github.com/algolia/autocomplete/blob/next/examples/react-instantsearch/src/components/Autocomplete.tsx
is giving me the following error:
Module '"algoliasearch/lite"' has no exported member 'SearchClient'.ts(2305)
How to fix?
I'm using the following npm packages:
"@algolia/autocomplete-js": "1.17.7",
"@algolia/autocomplete-plugin-query-suggestions": "1.17.7",
"@algolia/autocomplete-plugin-recent-searches": "1.17.7",
"@algolia/autocomplete-theme-classic": "1.17.7",
"algoliasearch": "5.15.0",
"react-instantsearch": "7.13.8",
"typescript": "5.7.2"
This example still has algoliasearch v4. Either:
- change to algoliasearch v4 and use the example as-is
- change
import type { SearchClient } from 'algoliasearch/lite'toimport type { LiteClient as SearchClient } from "algoliasearch/lite";and use v5 lite
Will leave this issue open until we update the examples to use v5 to avoid confusion
This example still has algoliasearch v4. Either:
- change to algoliasearch v4 and use the example as-is
- change
import type { SearchClient } from 'algoliasearch/lite'toimport type { LiteClient as SearchClient } from "algoliasearch/lite";and use v5 liteWill leave this issue open until we update the examples to use v5 to avoid confusion
Thanks, I will try the second option in the coming days and report back.
The following seems to be working - just updated my code:
change import type { SearchClient } from 'algoliasearch/lite' to import type { LiteClient as SearchClient } from "algoliasearch/lite"; and use v5 lite