Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(recommend): update TrendingFacetHit facetValue type to string #1498

Merged
merged 1 commit into from Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/recommend/src/types/TrendingFacetHit.ts
@@ -1,5 +1,5 @@
export type TrendingFacetHit<TObject> = {
export type TrendingFacetHit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this type is exported, it's a breaking change, someone who would be using TrendingFacetHit<string> will get a typescript error. Instead all generics should stay, defaulted to string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it is fine to have a build step breaking change in this case as it is a bug fix in typings.

Plus the usage for this model is very small and the update will be a one liner documented in the release notes.

readonly _score: number;
readonly facetName: string;
readonly facetValue: TObject;
readonly facetValue: string;
};
4 changes: 2 additions & 2 deletions packages/recommend/src/types/TrendingFacetsResponse.ts
Expand Up @@ -2,6 +2,6 @@ import { SearchResponse } from '@algolia/client-search';

import { TrendingFacetHit } from './TrendingFacetHit';

export type TrendingFacetsResponse<TObject> = Omit<SearchResponse<TObject>, 'hits'> & {
readonly hits: ReadonlyArray<TrendingFacetHit<TObject>>;
export type TrendingFacetsResponse = Omit<SearchResponse, 'hits'> & {
readonly hits: readonly TrendingFacetHit[];
};
6 changes: 3 additions & 3 deletions packages/recommend/src/types/WithRecommendMethods.ts
Expand Up @@ -11,11 +11,11 @@ import { TrendingFacetsResponse } from './TrendingFacetsResponse';
import { TrendingItemsQuery } from './TrendingItemsQuery';
import { TrendingQuery } from './TrendingQuery';

export type RecommendTrendingFacetsQueriesResponse<TObject> = {
export type RecommendTrendingFacetsQueriesResponse = {
/**
* The list of results.
*/
readonly results: ReadonlyArray<TrendingFacetsResponse<TObject>>;
readonly results: readonly TrendingFacetsResponse[];
};

export type RecommendQueriesResponse<TObject> = {
Expand Down Expand Up @@ -64,7 +64,7 @@ export type WithRecommendMethods<TType> = TType & {
readonly getTrendingFacets: <TObject>(
queries: readonly TrendingFacetsQuery[],
requestOptions?: RequestOptions & SearchOptions
) => Readonly<Promise<RecommendTrendingFacetsQueriesResponse<TObject>>>;
) => Readonly<Promise<RecommendTrendingFacetsQueriesResponse>>;

/**
* Returns Looking Similar
Expand Down