Skip to content

[bug]: v5.3.0 - search client instance type is not compatible with react-instant search v7.13.0 #1550

@WavyWalk

Description

@WavyWalk

Description

on latest versions:
"react-instantsearch": "7.13.0"
"algoliasearch": "5.3.0"

when setting SearchClient on InstantSearch as prop, compiler complains that searchForFacetValues is wrong

example:

import {InstantSearch} from "react-instantsearch";
import {SearchClient, algoliasearch} from "algoliasearch";

const searchClient: SearchClient = algoliasearch('appId', 'apiKey')

<InstantSearch
      indexName="indexName"
      searchClient={searchClient} // <--- compiler complains that face
/>

Repo with reproduction: https://github.com/WavyWalk/reproduce-algolia-v5/blob/typing-5-3-0/src/App.tsx

Client

Search

Version

5.3.0

Relevant log output

TS2322: Type
{   transporter: Transporter;   appId: string;   clearCache(): Promise<void>;   readonly _ua: string;   addAlgoliaAgent(segment: string, version?: string | undefined): void;   ... 76 more ...;   updateApiKey({key, apiKey}: UpdateApiKeyProps, requestOptions?: RequestOptions | undefined): Promise<...>; }
is not assignable to type SearchClient
Types of property searchForFacetValues are incompatible.
Type
({indexName, facetName, searchForFacetValuesRequest}: SearchForFacetValuesProps, requestOptions?: RequestOptions | undefined) => Promise<SearchForFacetValuesResponse>
is not assignable to type undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions