declare const typeBrand: unique symbol declare const targetTypeBrand: unique symbol export interface Result { /** Match score: 1 is exact, 0.5 is good, and 0 is no match */ readonly score: number /** Original target string */ readonly target: string highlight(highlightOpen?: string, highlightClose?: string, threshold?: number): string highlight(callback: HighlightCallback): (string | T)[] /** Matched character indexes */ indexes: ReadonlyArray } export interface Results extends ReadonlyArray { /** Number of matches before applying `limit` */ readonly total: number } export interface KeyResult extends Result { /** Original target object */ readonly obj: T } export interface KeyResults extends Results> {} export interface KeysResult extends ReadonlyArray { /** Combined match score: 1 is exact, 0.5 is good, and 0 is no match */ readonly score: number /** Original target object */ readonly obj: T } export interface KeysResults extends Results> {} /** A target returned by `fuzzysort.prepare()` */ export interface Prepared { readonly [typeBrand]: 'target' /** Original target string */ readonly target: string } export type Target = string | Prepared /** An immutable snapshot of string targets */ export interface Snapshot { readonly [typeBrand]: 'strings' } /** An immutable snapshot of objects searchable by one key */ export interface SnapshotKey { readonly [typeBrand]: 'key' readonly [targetTypeBrand]?: T } /** An immutable snapshot of objects searchable by multiple keys */ export interface SnapshotKeys { readonly [typeBrand]: 'keys' readonly [targetTypeBrand]?: T } export interface Options { /** Max results; defaults to 10; 0 = unlimited */ limit?: number /** Minimum score; defaults to .5; 0 = any match */ threshold?: number /** Override result scoring */ scoreFn?: (result: R) => number } /** A property path, path segments, or getter */ export type Key = string | ReadonlyArray | ((obj: T) => Target | null | undefined) export interface SnapshotKeyOptions { /** Key to search */ key: Key keys?: never } export interface SnapshotKeysOptions { /** Keys to search */ keys: ReadonlyArray> key?: never } export interface KeyOptions extends Options>, SnapshotKeyOptions {} export interface KeysOptions extends Options>, SnapshotKeysOptions {} export type HighlightCallback = (match: string, index: number) => T export interface Fuzzysort { single(search: string, target: Target): Result | null go(search: string, targets: ReadonlyArray | Snapshot, options?: Options): Results go(search: string, targets: ReadonlyArray, options: KeyOptions): KeyResults go(search: string, targets: ReadonlyArray, options: KeysOptions): KeysResults go(search: string, targets: SnapshotKey, options?: Options>): KeyResults go(search: string, targets: SnapshotKeys, options?: Options>): KeysResults /** Prepare one target for fast searching */ prepare(target: Target): Prepared /** Create an immutable snapshot for the best search performance; use when targets don't change */ snapshot(targets: ReadonlyArray): Snapshot snapshot(targets: ReadonlyArray, options: SnapshotKeyOptions): SnapshotKey snapshot(targets: ReadonlyArray, options: SnapshotKeysOptions): SnapshotKeys /** Highlight a result, including a structured clone */ highlight(result: Result, highlightOpen?: string, highlightClose?: string, threshold?: number): string highlight(result: Result, callback: HighlightCallback): (string | T)[] /** Read a result's score, including from a structured clone */ score(result: Result | KeysResult): number /** Add or override character remappings */ remap(mappings: Readonly>): void /** Clear internal caches */ cleanup(): void } export const single: Fuzzysort['single'] export const go: Fuzzysort['go'] export const highlight: Fuzzysort['highlight'] export const score: Fuzzysort['score'] export const remap: Fuzzysort['remap'] export const prepare: Fuzzysort['prepare'] export const snapshot: Fuzzysort['snapshot'] export const cleanup: Fuzzysort['cleanup'] declare const fuzzysort: Fuzzysort export default fuzzysort