@@ -4,8 +4,12 @@ import {
44 parseAlgoliaHitSnippet ,
55 parseAlgoliaHitReverseSnippet ,
66} from '@algolia/autocomplete-preset-algolia' ;
7+ import { Hit } from '@algolia/client-search' ;
78
8- type ParsedAttribute = { value : string ; isHighlighted : boolean } ;
9+ type ParsedAttribute = {
10+ value : string ;
11+ isHighlighted : boolean ;
12+ } ;
913
1014function concatParts (
1115 parts : ParsedAttribute [ ] ,
@@ -32,7 +36,7 @@ type HighlightItemParams<TItem> = {
3236/**
3337 * Highlights and escapes the matching parts of an Algolia hit.
3438 */
35- export function highlightItem < TItem extends object > ( {
39+ export function highlightItem < TItem extends Hit < { } > > ( {
3640 item,
3741 attribute,
3842 highlightPreTag = '<mark>' ,
@@ -54,7 +58,7 @@ export function highlightItem<TItem extends object>({
5458 *
5559 * This is a common pattern for Query Suggestions.
5660 */
57- export function reverseHighlightItem < TItem extends object > ( {
61+ export function reverseHighlightItem < TItem extends Hit < { } > > ( {
5862 item,
5963 attribute,
6064 highlightPreTag = '<mark>' ,
@@ -74,7 +78,7 @@ export function reverseHighlightItem<TItem extends object>({
7478/**
7579 * Highlights and escapes the matching parts of an Algolia hit snippet.
7680 */
77- export function snippetItem < TItem extends object > ( {
81+ export function snippetItem < TItem extends Hit < { } > > ( {
7882 item,
7983 attribute,
8084 highlightPreTag = '<mark>' ,
@@ -96,7 +100,7 @@ export function snippetItem<TItem extends object>({
96100 *
97101 * This is a common pattern for Query Suggestions.
98102 */
99- export function reverseSnippetItem < TItem extends object > ( {
103+ export function reverseSnippetItem < TItem extends Hit < { } > > ( {
100104 item,
101105 attribute,
102106 highlightPreTag = '<mark>' ,
0 commit comments