diff --git a/types/match-sorter/index.d.ts b/types/match-sorter/index.d.ts index 9d48e0b880..1df513584c 100644 --- a/types/match-sorter/index.d.ts +++ b/types/match-sorter/index.d.ts @@ -19,12 +19,10 @@ declare namespace matchSorter { } } -interface ExtendedKeyOptions { - minRanking?: number; - maxRanking?: number; - treshold?: number; - key: string | ((item: T) => string); -} +type ExtendedKeyOptions = { key: string | ((item: T) => string) } & ( + | { minRanking: number; threshold?: number } + | { maxRanking: number; threshold?: number } + | { threshold: number }); interface Options { keys?: Array string) | ExtendedKeyOptions>; @@ -39,6 +37,10 @@ interface Options { * @param options - Some options to configure the sorter * @return the new sorted array */ -declare function matchSorter(items: ReadonlyArray, value: string, options?: Options): T[]; +declare function matchSorter( + items: ReadonlyArray, + value: string, + options?: Options +): T[]; export = matchSorter;