From 8adb5215bfd03f979a5f47ac865a9352eafc808a Mon Sep 17 00:00:00 2001 From: flycran Date: Fri, 9 May 2025 11:49:34 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E6=AD=A3`StoreOptions`=E7=B1=BB?= =?UTF-8?q?=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