From 5c341e4295b9a968b224f40d130fa3ea94099cfe Mon Sep 17 00:00:00 2001 From: Thomas Wilkerling Date: Fri, 9 May 2025 11:26:19 +0200 Subject: [PATCH] replace unknown type in index.d.ts --- index.d.ts | 8 ++++---- test/types.ts | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index d02f78c..fa753b7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -994,16 +994,16 @@ declare module "flexsearch" { constructor(options?: ResolverOptions | IntermediateSearchResults); - and(...args: ResolverOptions[]): + and(...args: ResolverOptions[]): IndexSearchResultsWrapper; - or(...args: ResolverOptions[]): + or(...args: ResolverOptions[]): IndexSearchResultsWrapper; - xor(...args: ResolverOptions[]): + xor(...args: ResolverOptions[]): IndexSearchResultsWrapper; - not(...args: ResolverOptions[]): + not(...args: ResolverOptions[]): IndexSearchResultsWrapper; limit(limit: number): Resolver; diff --git a/test/types.ts b/test/types.ts index 566148f..c31bf52 100644 --- a/test/types.ts +++ b/test/types.ts @@ -193,10 +193,12 @@ async function test_document() { const doc26: EnrichedResults = doc24.and({}, { index: document2 }).resolve({ enrich: true }); // highlight within last resolver stage is work in progress: const doc27: EnrichedResults = doc24.and({}, { index: document2, resolve: true, highlight: "" }); + const doc28: DefaultSearchResults = document2.search({ pluck: { field: "meta:title", limit: 10 } }); + const doc30: EnrichedResults = document2.search({ pluck: { field: "meta:title", highlight: true } }); // highlight on .resolve() is never supported: // @ts-expect-error - const doc28: EnrichedResults = doc24.resolve({ highlight: "" }); + const err0: EnrichedResults = doc24.resolve({ highlight: "" }); // @ts-expect-error const err1: DocumentData = doc1[0].result[0].doc;