declare namespace Fuzzysort { interface Result { /** * 1 is a perfect match. 0.5 is a good match. 0 is no match. */ readonly score: number /** Your original target string */ readonly target: string highlight(highlightOpen?: string, highlightClose?: string): string highlight(callback: HighlightCallback): (string | T)[] indexes: ReadonlyArray } interface Results extends ReadonlyArray { /** Total matches before limit */ readonly total: number } interface KeyResult extends Result { /** Your original object */ readonly obj: T } interface KeyResults extends ReadonlyArray> { /** Total matches before limit */ readonly total: number } interface KeysResult extends ReadonlyArray { /** * 1 is a perfect match. 0.5 is a good match. 0 is no match. */ readonly score: number /** Your original object */ readonly obj: T } interface KeysResults extends ReadonlyArray> { /** Total matches before limit */ readonly total: number } interface Prepared { /** Your original target string */ readonly target: string } interface Options { /** Don't return matches worse than this (higher is faster) */ threshold?: number /** Don't return more results than this (lower is faster) */ limit?: number /** If true, returns all results for an empty search */ all?: boolean } interface KeyOptions extends Options { key: string | ((obj: T) => string) | ReadonlyArray } interface KeysOptions extends Options { keys: ReadonlyArray string) | ReadonlyArray> scoreFn?: (keysResult: KeysResult) => number } interface HighlightCallback { (match: string, index: number): T } interface Fuzzysort { single(search: string, target: string | Prepared): Result | null go(search: string, targets: ReadonlyArray, options?: Options): Results go(search: string, targets: ReadonlyArray, options: KeyOptions): KeyResults go(search: string, targets: ReadonlyArray, options: KeysOptions): KeysResults /** * Help the algorithm go fast by providing prepared targets instead of raw strings */ prepare(target: string): Prepared /** * Free memory caches if you're done using fuzzysort for now */ cleanup(): void } } declare module "fuzzysort" { const fuzzysort:Fuzzysort.Fuzzysort export = fuzzysort }