From 607300efe1e6e567d2e85ea5813a7599110ed027 Mon Sep 17 00:00:00 2001 From: Thomas Wilkerling Date: Tue, 1 Apr 2025 07:37:36 +0200 Subject: [PATCH] index.d.ts describe default export --- index.d.ts | 39 ++++++++++++++++++++++++--------------- package.json | 2 +- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/index.d.ts b/index.d.ts index a416b3a..7b04796 100644 --- a/index.d.ts +++ b/index.d.ts @@ -58,7 +58,7 @@ declare module "flexsearch" { | "LatinAdvanced" | "LatinExtra" | "LatinSoundex" - | ((term: string) => string[]); + | ((content: string) => string[]); /** * **Document:** @@ -141,17 +141,14 @@ declare module "flexsearch" { char?: string|string[]; }; - export type Charset = { - LatinExact: EncoderOptions; - LatinDefault: EncoderOptions; - LatinSimple: EncoderOptions; - LatinBalance: EncoderOptions; - LatinAdvanced: EncoderOptions; - LatinExtra: EncoderOptions; - LatinSoundex: EncoderOptions; - ArabicDefault: EncoderOptions; - CjkDefault: EncoderOptions; - CyrillicDefault: EncoderOptions; + export const Charset: { + Exact: EncoderOptions, + Default: EncoderOptions, + Normalize: EncoderOptions, + LatinBalance: EncoderOptions, + LatinAdvanced: EncoderOptions, + LatinExtra: EncoderOptions, + LatinSoundex: EncoderOptions }; /** @@ -190,7 +187,7 @@ declare module "flexsearch" { commit?: boolean; // Language-specific Options and Encoding - encoder?: Charset | Encoders | EncoderOptions; + encoder?: typeof Charset | Encoders | EncoderOptions; encode?: (text: string) => string[], rtl?: boolean; }; @@ -339,8 +336,8 @@ declare module "flexsearch" { type DocumentOptions = IndexOptions & { worker?: boolean | WorkerURL | WorkerPath; - doc?: DocumentDescriptor | DocumentDescriptor[]; - document?: DocumentDescriptor | DocumentDescriptor[]; + doc?: DocumentDescriptor; + document?: DocumentDescriptor; }; type DefaultDocumentSearchResults = Array<{ @@ -589,6 +586,18 @@ declare module "flexsearch" { export class IndexedDB extends StorageInterface{ db: IDBDatabase } + + const FlexSearch: { + Index: typeof Index, + Document: typeof Document, + Worker: typeof Worker, + Encoder: typeof Encoder, + Charset: typeof Charset, + Resolver: typeof Resolver, + IndexedDB: typeof IndexedDB + } + + export default FlexSearch; } // https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html diff --git a/package.json b/package.json index 34ed0a4..24bdd8f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "public": true, "preferGlobal": false, "name": "flexsearch", - "version": "0.8.147", + "version": "0.8.148", "description": "Next-Generation full-text search library for Browser and Node.js", "homepage": "https://github.com/nextapps-de/flexsearch/", "author": "Thomas Wilkerling",