diff --git a/index.d.ts b/index.d.ts index 2bad641..ba4af3a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -404,21 +404,32 @@ 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 FieldOptions = IndexOptions & DefaultFieldOptions & { - config?: WorkerConfigURL | WorkerConfigPath; + export type DefaultCustomFieldOptions< + D = DocumentData, + > = IndexOptions & { + custom: CustomFN; + field: FieldName; + filter?: (doc: D) => boolean; + db?: StorageInterface; }; - export type TagOptions = DefaultFieldOptions; + export type TagOptions = DefaultFieldOptions | DefaultCustomFieldOptions; - export type StoreOptions = DefaultFieldOptions; + export type StoreOptions = DefaultFieldOptions | DefaultCustomFieldOptions; + + export interface IndexWorkerConfig { + config?: WorkerConfigURL | WorkerConfigPath; + } + + export type FieldOptions = + (DefaultFieldOptions & IndexWorkerConfig) + | (DefaultCustomFieldOptions & IndexWorkerConfig) /** * # Document Search Result