Skip to content

Commit 5c66903

Browse files
committed
Typescript improvements
1 parent 861f6ff commit 5c66903

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

refactor/src/components/AlgoliaSearch/SearchResults.component.tsx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,28 @@ import Link from 'next/link';
22

33
import { trimmedStringToLength } from '@/utils/functions/functions';
44

5+
interface ISearchResultProps {
6+
hit: {
7+
product_image: string;
8+
product_name: string;
9+
regular_price: string;
10+
sale_price: string;
11+
on_sale: boolean;
12+
short_description: string;
13+
objectID: number;
14+
};
15+
}
16+
517
/**
618
* Displays search results from Algolia
7-
* @param {Object} hit {
8-
* @param {String} product_image Product image from WooCommerce
9-
* @param {String} product_name Name of product
10-
* @param {Float} regular_price Price without discount
11-
* @param {Float} sale_price Price when on sale
12-
* @param {Boolean} on_sale Is the product on sale? True or false
13-
* @param {String} short_description Short description of product
14-
* @param {Integer} objectID ID of product
19+
* @param {object} hit {
20+
* @param {string} product_image Product image from WooCommerce
21+
* @param {string} product_name Name of product
22+
* @param {string} regular_price Price without discount
23+
* @param {string} sale_price Price when on sale
24+
* @param {boolean} on_sale Is the product on sale? True or false
25+
* @param {string} short_description Short description of product
26+
* @param {number} objectID ID of product
1527
}
1628
*/
1729
const SearchResults = ({
@@ -24,7 +36,7 @@ const SearchResults = ({
2436
short_description,
2537
objectID,
2638
},
27-
}: any) => {
39+
}: ISearchResultProps) => {
2840
// Replace empty spaces with dash (-)
2941
const trimmedProductName = product_name.replace(/ /g, '-');
3042

0 commit comments

Comments
 (0)