mirror of
https://github.com/vercel/commerce.git
synced 2025-06-05 07:46:58 +00:00
Resolves a TypeScript error in `app/search/page.tsx`: "Type error: Argument of type 'any[] | undefined' is not assignable to parameter of type 'SetStateAction<any[]>'." The `getSearchResults` function has been updated to: 1. Explicitly define its return type as `Promise<any[]>`. 2. Ensure that all code paths return an array, defaulting to an empty array `[]` if no specific or generic results are found, or if the query is empty/whitespace. This guarantees that `setResults` always receives an array, satisfying the type constraints of `useState<any[]>`.