import Searchkit, { MultipleQueriesQuery, RequestOptions } from 'searchkit'; import { SearchClient } from 'instantsearch.js'; /** * The client returned by `createClient`: InstantSearch's own `SearchClient` type, so it is * checked against whatever InstantSearch expects, plus `clearCache`, which InstantSearch * calls on `refresh()`. * * `search` and `searchForFacetValues` also carry the client's actual signatures, which accept * readonly request arrays. Different instantsearch.js versions declare the requests as mutable * or readonly arrays; these signatures keep the client assignable to either. */ type SearchkitInstantSearchClient = SearchClient & { search: (requests: readonly MultipleQueriesQuery[]) => Promise; searchForFacetValues: (requests: readonly MultipleQueriesQuery[]) => Promise; clearCache: () => Promise; }; interface InstantSearchElasticsearchAdapterConfig { url: string; headers?: Record | (() => Record); onError?: (error: Error) => boolean | void; } type Config = InstantSearchElasticsearchAdapterConfig | Searchkit; declare const createClient: (config: Config, requestOptions?: RequestOptions) => SearchkitInstantSearchClient; export { SearchkitInstantSearchClient, createClient as default };