refactor(*): Cast instead of declaring a new const

This commit is contained in:
Josh Creek
2024-10-15 19:54:11 +01:00
parent 8221224255
commit 79e2dcb744
+2 -4
View File
@@ -430,9 +430,7 @@ const getActiveProductsWithPrices = async (limit = 10, offset = 0) => {
throw new Error(`Error fetching products: ${error.message}`); throw new Error(`Error fetching products: ${error.message}`);
} }
const typedProducts: ProductWithPrices[] = products; for (const product of products as ProductWithPrices[]) {
for (const product of typedProducts) {
if (product.prices && product.prices.length > 0) { if (product.prices && product.prices.length > 0) {
// Assuming the default price is the first one // Assuming the default price is the first one
const defaultPrice = product.prices[0]; const defaultPrice = product.prices[0];
@@ -440,7 +438,7 @@ const getActiveProductsWithPrices = async (limit = 10, offset = 0) => {
} }
} }
return { products: typedProducts, count }; // Return products and total count return { products, count }; // Return products and total count
}; };
export { export {