This message was deleted.
# community-help
s
This message was deleted.
j
typesense-js is actually written in Typescript and types are exposed as public interfaces. If you search the code base for each type, you'll find the type definition you can import
d
Sorry @Jason Bosco, I'm not exactly sure how you intend for me to access these. The interface I need is the
SearchResponse
out of
Documents.d.ts
but these types aren't included in the exports of
Typesense.d.ts
which is the only types definition provided in
package.json
my goal is to have the type of the
documents().search()
be correctly typed with my document interface
right now I'm using
export type SearchResponse = Awaited<ReturnType<SearchController['search']>>
which is returning
SearchResult<object>
j
Could you try something like
import { SearchResponse } from "typesense/src/Typesense/Documents"
d
ah that's a bit prettier than what I was doing, but do you know of a way to use my concrete interface in the response?
j
If you import from
src
, the response should be automatically typed btw...
But I'm not a Typescript expert, so may be someone else from #community-help can answer this question.
d
ah you're totally right, with that I can pass my document schema as the concrete to the generic
return await ....documents().search(searchParams) as SearchResponse<DocSchema>