Skip to content

Commit

Permalink
Merge pull request #160 from ycouble/master
Browse files Browse the repository at this point in the history
MultiSearch: multiSearch.perform types
  • Loading branch information
jasonbosco authored Jun 16, 2023
2 parents b27653c + 06678a4 commit 893dc6f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Typesense/MultiSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export interface MultiSearchRequestsSchema {
searches: (MultiSearchRequestSchema | MultiSearchRequestWithPresetSchema)[]
}

export interface MultiSearchResponse<T extends DocumentSchema = {}> {
results: SearchResponse<T>[]
export interface MultiSearchResponse<T extends DocumentSchema[] = []> {
results: { [Index in keyof T]: SearchResponse<T[Index]> } & { length: T['length'] }
}

export default class MultiSearch<T extends DocumentSchema = {}> {
export default class MultiSearch {
private requestWithCache: RequestWithCache

constructor(
Expand All @@ -38,7 +38,7 @@ export default class MultiSearch<T extends DocumentSchema = {}> {
this.requestWithCache.clearCache()
}

async perform(
async perform<T extends DocumentSchema[] = []>(
searchRequests: MultiSearchRequestsSchema,
commonParams: Partial<MultiSearchRequestSchema> = {},
{
Expand Down

0 comments on commit 893dc6f

Please sign in to comment.