1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-08-28 16:20:04 +02:00

- 修正StoreOptions类型推断。

This commit is contained in:
flycran
2025-05-09 11:49:34 +08:00
parent 2431b51a4f
commit 8adb5215bf

15
index.d.ts vendored
View File

@@ -404,10 +404,17 @@ declare module "flexsearch" {
export type DefaultFieldOptions< export type DefaultFieldOptions<
D = DocumentData, D = DocumentData,
C extends CustomFN<D> | boolean = false
> = IndexOptions & { > = IndexOptions & {
custom?: C; field: FieldName<D>;
field: C extends false ? FieldName<D> : FieldName; filter?: (doc: D) => boolean;
db?: StorageInterface;
};
export type DefaultCustomFieldOptions<
D = DocumentData,
> = IndexOptions & {
custom: CustomFN<D>;
field: FieldName;
filter?: (doc: D) => boolean; filter?: (doc: D) => boolean;
db?: StorageInterface; db?: StorageInterface;
}; };
@@ -418,7 +425,7 @@ declare module "flexsearch" {
export type TagOptions<D = DocumentData> = DefaultFieldOptions<D>; export type TagOptions<D = DocumentData> = DefaultFieldOptions<D>;
export type StoreOptions<D = DocumentData> = DefaultFieldOptions<D>; export type StoreOptions<D = DocumentData> = DefaultFieldOptions<D> | DefaultCustomFieldOptions<D>;
/** /**
* # Document Search Result * # Document Search Result