Skip to content

Commit

Permalink
refactor: Remove Omit type from search options interfaces
Browse files Browse the repository at this point in the history
The commit removes unnecessary Omit type wrappers from search and suggest
options interfaces. This simplifies the type definitions while maintaining
the same functionality, as the 'q' parameter is handled internally by the
components.
  • Loading branch information
joerideg committed Dec 9, 2024
1 parent c0b3b4a commit 5a017e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/results/results.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const configuration: Configuration = {
domain_key: 'showcase_pacifichome',
};

const searchOptions: Omit<ProductSearchOptions, 'q'> = {
const searchOptions: ProductSearchOptions = {
_br_uid_2: 'test',
fl: 'pid,title,description,price,sale_price,thumb_image',
rows: 12,
Expand Down
4 changes: 2 additions & 2 deletions src/components/search-box/search-box.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ const configuration: Configuration = {
domain_key: 'showcase_pacifichome',
};

const suggestOptions: Omit<AutosuggestOptions, 'q'> = {
const suggestOptions: AutosuggestOptions = {
_br_uid_2: 'test',
catalog_views: 'showcase_pacifichome',
url: 'https://example.com',
};

const searchOptions: Omit<ProductSearchOptions, 'q'> = {
const searchOptions: ProductSearchOptions = {
_br_uid_2: 'test',
fl: 'pid,title,description',
rows: 2,
Expand Down
10 changes: 5 additions & 5 deletions src/components/search-box/search-box.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export type SearchBoxProps = PropsWithChildren &
* The options specific to a Bloormeach search API e.g. `q` and `fl`
*/
searchOptions:
| Omit<ProductSearchOptions, 'q'>
| Omit<ContentSearchOptions, 'q'>
| Omit<BestsellerOptions, 'q'>
| Omit<CategorySearchOptions, 'q'>;
| ProductSearchOptions
| ContentSearchOptions
| BestsellerOptions
| CategorySearchOptions;

/**
* The type of search.
Expand Down Expand Up @@ -130,7 +130,7 @@ export type SuggestionsProps = {
/**
* The options specific to a Bloormeach suggestions request
*/
suggestOptions: Omit<AutosuggestOptions, 'q'>;
suggestOptions: AutosuggestOptions;

/**
* The callback to execute when a query suggestion is clicked
Expand Down

0 comments on commit 5a017e5

Please sign in to comment.