1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-08-27 15:50:44 +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<
D = DocumentData,
C extends CustomFN<D> | boolean = false
> = IndexOptions & {
custom?: C;
field: C extends false ? FieldName<D> : FieldName;
field: FieldName<D>;
filter?: (doc: D) => boolean;
db?: StorageInterface;
};
export type DefaultCustomFieldOptions<
D = DocumentData,
> = IndexOptions & {
custom: CustomFN<D>;
field: FieldName;
filter?: (doc: D) => boolean;
db?: StorageInterface;
};
@@ -418,7 +425,7 @@ declare module "flexsearch" {
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