Closed
Description
Description
The Meilisearch JavaScript library, meilisearch-js, is causing my TypeScript project to fail to compile due to some type signature errors in the file http-requests.ts.
I have cloned the repo, and I have precisely found where is the faulty code (see screenshot below)
When I try to compile my project, I get 3 errors that fall under TS2339, TS2358, TS2339:
Expected behavior
Errorless compilation
Current behavior
compile errors TS2339, TS2358, TS2339
ERROR in ./node_modules/meilisearch/src/http-requests.ts:24:37
TS2339: Property 'join' does not exist on type 'T[keyof T]'.
22 | return acc
23 | } else if (Array.isArray(value)) {
> 24 | return { ...acc, [key]: value.join(',') }
| ^^^^
25 | } else if (value instanceof Date) {
26 | return { ...acc, [key]: value.toISOString() }
27 | }
ERROR in ./node_modules/meilisearch/src/http-requests.ts:25:16
TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
23 | } else if (Array.isArray(value)) {
24 | return { ...acc, [key]: value.join(',') }
> 25 | } else if (value instanceof Date) {
| ^^^^^
26 | return { ...acc, [key]: value.toISOString() }
27 | }
28 | return { ...acc, [key]: value }
ERROR in ./node_modules/meilisearch/src/http-requests.ts:26:37
TS2339: Property 'toISOString' does not exist on type 'never'.
24 | return { ...acc, [key]: value.join(',') }
25 | } else if (value instanceof Date) {
> 26 | return { ...acc, [key]: value.toISOString() }
| ^^^^^^^^^^^
27 | }
28 | return { ...acc, [key]: value }
29 | }, {} as queryParams<T>)
Environment (please complete the following information):
- OS: [e.g. Debian GNU/Linux] MacOS Sonoma
- Meilisearch version: [e.g. v.0.20.0] Irrelevant information
- meilisearch-js version: [e.g v0.18.2] 0.35.0
- Browser: [e.g. Chrome version 90.0] Irrelevant information
- Node version: v18.17.1