TypeScript hitComponent type?

Assuming we want to render a custom hitComponent using the <Hits /> component from react-instantsearch-hooks-web, when using:

<Hits hitComponent={Hit} /> what is the proper way to type the <Hit> component?

eg: function Hit({ hit }: { hit: ??? }) { }


It looks like you should use the AlgoliaHit class and inherit from your custom type, for example:

export interface ProductRecord {
  name: string
  price: number


I’ve found an example here:

1 Like