1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-25 12:58:59 +02:00

index.d.ts describe default export

This commit is contained in:
Thomas Wilkerling
2025-04-01 07:37:36 +02:00
parent 40f17691bf
commit 607300efe1
2 changed files with 25 additions and 16 deletions

39
index.d.ts vendored
View File

@@ -58,7 +58,7 @@ declare module "flexsearch" {
| "LatinAdvanced" | "LatinAdvanced"
| "LatinExtra" | "LatinExtra"
| "LatinSoundex" | "LatinSoundex"
| ((term: string) => string[]); | ((content: string) => string[]);
/** /**
* **Document:** * **Document:**
@@ -141,17 +141,14 @@ declare module "flexsearch" {
char?: string|string[]; char?: string|string[];
}; };
export type Charset = { export const Charset: {
LatinExact: EncoderOptions; Exact: EncoderOptions,
LatinDefault: EncoderOptions; Default: EncoderOptions,
LatinSimple: EncoderOptions; Normalize: EncoderOptions,
LatinBalance: EncoderOptions; LatinBalance: EncoderOptions,
LatinAdvanced: EncoderOptions; LatinAdvanced: EncoderOptions,
LatinExtra: EncoderOptions; LatinExtra: EncoderOptions,
LatinSoundex: EncoderOptions; LatinSoundex: EncoderOptions
ArabicDefault: EncoderOptions;
CjkDefault: EncoderOptions;
CyrillicDefault: EncoderOptions;
}; };
/** /**
@@ -190,7 +187,7 @@ declare module "flexsearch" {
commit?: boolean; commit?: boolean;
// Language-specific Options and Encoding // Language-specific Options and Encoding
encoder?: Charset | Encoders | EncoderOptions; encoder?: typeof Charset | Encoders | EncoderOptions;
encode?: (text: string) => string[], encode?: (text: string) => string[],
rtl?: boolean; rtl?: boolean;
}; };
@@ -339,8 +336,8 @@ declare module "flexsearch" {
type DocumentOptions = IndexOptions & { type DocumentOptions = IndexOptions & {
worker?: boolean | WorkerURL | WorkerPath; worker?: boolean | WorkerURL | WorkerPath;
doc?: DocumentDescriptor | DocumentDescriptor[]; doc?: DocumentDescriptor;
document?: DocumentDescriptor | DocumentDescriptor[]; document?: DocumentDescriptor;
}; };
type DefaultDocumentSearchResults = Array<{ type DefaultDocumentSearchResults = Array<{
@@ -589,6 +586,18 @@ declare module "flexsearch" {
export class IndexedDB extends StorageInterface{ export class IndexedDB extends StorageInterface{
db: IDBDatabase 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 // https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html

View File

@@ -2,7 +2,7 @@
"public": true, "public": true,
"preferGlobal": false, "preferGlobal": false,
"name": "flexsearch", "name": "flexsearch",
"version": "0.8.147", "version": "0.8.148",
"description": "Next-Generation full-text search library for Browser and Node.js", "description": "Next-Generation full-text search library for Browser and Node.js",
"homepage": "https://github.com/nextapps-de/flexsearch/", "homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling", "author": "Thomas Wilkerling",