From 8adb5215bfd03f979a5f47ac865a9352eafc808a Mon Sep 17 00:00:00 2001 From: flycran Date: Fri, 9 May 2025 11:49:34 +0800 Subject: [PATCH 1/3] =?UTF-8?q?-=20=E4=BF=AE=E6=AD=A3`StoreOptions`?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=8E=A8=E6=96=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.d.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 2bad641..33d906a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -404,10 +404,17 @@ declare module "flexsearch" { export type DefaultFieldOptions< D = DocumentData, - C extends CustomFN | boolean = false > = IndexOptions & { - custom?: C; - field: C extends false ? FieldName : FieldName; + field: FieldName; + filter?: (doc: D) => boolean; + db?: StorageInterface; + }; + + export type DefaultCustomFieldOptions< + D = DocumentData, + > = IndexOptions & { + custom: CustomFN; + field: FieldName; filter?: (doc: D) => boolean; db?: StorageInterface; }; @@ -418,7 +425,7 @@ declare module "flexsearch" { export type TagOptions = DefaultFieldOptions; - export type StoreOptions = DefaultFieldOptions; + export type StoreOptions = DefaultFieldOptions | DefaultCustomFieldOptions; /** * # Document Search Result From 7027a11518a6100c833cb8975aeed2c702415402 Mon Sep 17 00:00:00 2001 From: flycran Date: Fri, 9 May 2025 12:10:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?-=20=E4=BF=AE=E6=AD=A3`DocumentOptions['ind?= =?UTF-8?q?ex']`=E7=B1=BB=E5=9E=8B=E6=8E=A8=E6=96=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.d.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 33d906a..38fde09 100644 --- a/index.d.ts +++ b/index.d.ts @@ -419,14 +419,18 @@ declare module "flexsearch" { db?: StorageInterface; }; - export type FieldOptions = IndexOptions & DefaultFieldOptions & { - config?: WorkerConfigURL | WorkerConfigPath; - }; - export type TagOptions = DefaultFieldOptions; export type StoreOptions = DefaultFieldOptions | DefaultCustomFieldOptions; + export interface IndexWorkerConfig { + config?: WorkerConfigURL | WorkerConfigPath; + } + + export type FieldOptions = + (DefaultFieldOptions & IndexWorkerConfig) + | (DefaultCustomFieldOptions & IndexWorkerConfig) + /** * # Document Search Result * From 36a9c96acd03ff64a1d18b2bf54bdbf7abdf848d Mon Sep 17 00:00:00 2001 From: flycran Date: Fri, 9 May 2025 12:11:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?-=20=E4=BF=AE=E6=AD=A3`DocumentOptions['tag?= =?UTF-8?q?']`=E7=B1=BB=E5=9E=8B=E6=8E=A8=E6=96=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 38fde09..ba4af3a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -419,7 +419,7 @@ declare module "flexsearch" { db?: StorageInterface; }; - export type TagOptions = DefaultFieldOptions; + export type TagOptions = DefaultFieldOptions | DefaultCustomFieldOptions; export type StoreOptions = DefaultFieldOptions | DefaultCustomFieldOptions;