declare namespace Fuzzysort { interface Result { /** * Higher is better * * 0 is a perfect match; -1000 is a bad match */ readonly score: number /** Your original target string */ readonly target: string /** Indexes of the matching target characters */ readonly indexes: number[] } interface Results extends ReadonlyArray { /** Total matches before limit */ readonly total: number } interface KeyResult extends Result { /** Your original object */ readonly obj: T } interface KeysResult extends ReadonlyArray { /** * Higher is better * * 0 is a perfect match; -1000 is a bad match */ readonly score: number /** Your original object */ readonly obj: T } interface KeyResults extends ReadonlyArray> { /** Total matches before limit */ readonly total: number } interface KeysResults extends ReadonlyArray> { /** Total matches before limit */ readonly total: number } interface Prepared { /** Your original target string */ readonly target: string } interface CancelablePromise extends Promise { cancel(): void } 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 /** Allwos a snigle transpoes (false is faster) */ allowTypo?: boolean } interface KeyOptions extends Options { key: string | ReadonlyArray } interface KeysOptions extends Options { keys: ReadonlyArray> scoreFn?: (keysResult:ReadonlyArray>) => number } interface HighlightCallback { (match: string, index: number): T } interface Fuzzysort { /** * Help the algorithm go fast by providing prepared targets instead of raw strings */ prepare(target: string): Prepared highlight(result?: Result, highlightOpen?: string, highlightClose?: string): string | null highlight(result: Result, callback: HighlightCallback): (string | T)[] | null 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 goAsync(search: string, targets: ReadonlyArray, options?: Options): CancelablePromise goAsync(search: string, targets: ReadonlyArray, options: KeyOptions): CancelablePromise> goAsync(search: string, targets: ReadonlyArray, options: KeysOptions): CancelablePromise> /** Returns a new instance of fuzzysort, which you can give different default options to */ 'new'(options?: Options): Fuzzysort } } declare module "fuzzysort" { const fuzzysort:Fuzzysort.Fuzzysort export = fuzzysort }