diff --git a/packages/algoliasearch-helper/types/algoliasearch.d.ts b/packages/algoliasearch-helper/types/algoliasearch.d.ts index 6365739448..76a5845ef5 100644 --- a/packages/algoliasearch-helper/types/algoliasearch.d.ts +++ b/packages/algoliasearch-helper/types/algoliasearch.d.ts @@ -168,76 +168,69 @@ export type RecommendResponse = PickForClient<{ v5: AlgoliaSearch.RecommendationsResults; }>; -export type RecommendResponses = { - results: Array>; -}; +export type RecommendResponses = PickForClient<{ + v3: any; + // @ts-ignore + v4: { results: Array> }; + // @ts-ignore + v5: AlgoliaSearch.GetRecommendationsResponse; +}>; // We remove `indexName` from the Recommend query types as the helper // will fill in this value before sending the queries -type _OmitIndexName = Omit; type _OptionalKeys = Omit & Partial>; type _RequiredKeys = Omit & Required>; -export type FrequentlyBoughtTogetherQuery = _OmitIndexName< - PickForClient<{ - v3: any; - // @ts-ignore - v4: RecommendClient.FrequentlyBoughtTogetherQuery; - // @ts-ignore - v5: OptionalKeys< - Omit, - 'threshold' - >; - }> ->; -export type LookingSimilarQuery = _OmitIndexName< - PickForClient<{ - v3: any; - // @ts-ignore - v4: RecommendClient.LookingSimilarQuery; - // @ts-ignore - v5: OptionalKeys< - Omit, - 'threshold' - >; - }> ->; -export type RelatedProductsQuery = _OmitIndexName< - PickForClient<{ - v3: any; - // @ts-ignore - v4: RecommendClient.RelatedProductsQuery; - // @ts-ignore - v5: OptionalKeys< - Omit, - 'threshold' - >; - }> ->; -export type TrendingFacetsQuery = _OmitIndexName< - PickForClient<{ - v3: any; - // @ts-ignore - v4: RecommendClient.TrendingFacetsQuery; - // @ts-ignore - v5: OptionalKeys< - Omit, - 'threshold' - >; - }> ->; -export type TrendingItemsQuery = _OmitIndexName< - PickForClient<{ - v3: any; - // @ts-ignore - v4: RecommendClient.TrendingItemsQuery; - // @ts-ignore - v5: OptionalKeys< - Omit, - 'threshold' - >; - }> ->; +export type FrequentlyBoughtTogetherQuery = PickForClient<{ + v3: any; + // @ts-ignore + v4: Omit; + // @ts-ignore + v5: OptionalKeys< + Omit, + 'threshold' + >; +}>; +export type LookingSimilarQuery = PickForClient<{ + v3: any; + // @ts-ignore + v4: Omit; + // @ts-ignore + v5: OptionalKeys< + Omit, + 'threshold' + >; +}>; +export type RelatedProductsQuery = PickForClient<{ + v3: any; + // @ts-ignore + v4: Omit; + // @ts-ignore + v5: OptionalKeys< + Omit, + 'threshold' + >; +}>; +export type TrendingFacetsQuery = PickForClient<{ + v3: any; + // @ts-ignore + v4: Omit; + // @ts-ignore + v5: OptionalKeys< + Omit, + 'threshold' + >; +}>; +export type TrendingItemsQuery = PickForClient<{ + v3: any; + // @ts-ignore + v4: Omit; + // @ts-ignore + v5: _OptionalKeys< + Omit, + 'threshold' + >; +}>; export type RecommendOptions = | _RequiredKeys< @@ -245,23 +238,23 @@ export type RecommendOptions = indexName: string; model: 'bought-together'; }, - 'threshold' + 'threshold' | 'indexName' | 'model' > | _RequiredKeys< LookingSimilarQuery & { indexName: string; model: 'looking-similar' }, - 'threshold' + 'threshold' | 'indexName' | 'model' > | _RequiredKeys< RelatedProductsQuery & { indexName: string; model: 'related-products' }, - 'threshold' + 'threshold' | 'indexName' | 'model' > | _RequiredKeys< TrendingFacetsQuery & { indexName: string; model: 'trending-facets' }, - 'threshold' + 'threshold' | 'indexName' | 'model' > | _RequiredKeys< TrendingItemsQuery & { indexName: string; model: 'trending-items' }, - 'threshold' + 'threshold' | 'indexName' | 'model' >; export type PlainRecommendParameters =