<commit_before>// Type definitions for match-sorter 2.3
// Project: https://github.com/kentcdodds/match-sorter#readme
// Definitions by: <NAME> <https://github.com/claasahl>
//                 <NAME> <https://github.com/chrisru>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare namespace matchSorter {
    namespace rankings {
        const CASE_SENSITIVE_EQUAL: 9;
        const EQUAL: 8;
        const STARTS_WITH: 7;
        const WORD_STARTS_WITH: 6;
        const STRING_CASE: 5;
        const STRING_CASE_ACRONYM: 4;
        const CONTAINS: 3;
        const ACRONYM: 2;
        const MATCHES: 1;
        const NO_MATCH: 0;
    }
}

interface ExtendedKeyOptions<T> {
    minRanking?: number;
    maxRanking?: number;
    treshold?: number;
    key: string | ((item: T) => string);
}

interface Options<T> {
    keys?: Array<string | ((item: T) => string) | ExtendedKeyOptions<T>>;
    threshold?: number;
    keepDiacritics?: boolean;
}

/**
 * Takes an array of items and a value and returns a new array with the items that match the given value
 * @param items - the items to sort
 * @param value - the value to use for ranking
 * @param options - Some options to configure the sorter
 * @return the new sorted array
 */
declare function matchSorter<T>(items: ReadonlyArray<T>, value: string, options?: Options<T>): T[];

export = matchSorter;<commit_msg>Fix typo and make ExtendedKeyOptions more restrictive<commit_after>// Type definitions for match-sorter 2.3
// Project: https://github.com/kentcdodds/match-sorter#readme
// Definitions by: <NAME> <https://github.com/claasahl>
//                 <NAME> <https://github.com/chrisru>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare namespace matchSorter {
    namespace rankings {
        const CASE_SENSITIVE_EQUAL: 9;
        const EQUAL: 8;
        const STARTS_WITH: 7;
        const WORD_STARTS_WITH: 6;
        const STRING_CASE: 5;
        const STRING_CASE_ACRONYM: 4;
        const CONTAINS: 3;
        const ACRONYM: 2;
        const MATCHES: 1;
        const NO_MATCH: 0;
    }
}

type ExtendedKeyOptions<T> = { key: string | ((item: T) => string) } & (
    | { minRanking: number; threshold?: number }
    | { maxRanking: number; threshold?: number }
    | { threshold: number });

interface Options<T> {
    keys?: Array<string | ((item: T) => string) | ExtendedKeyOptions<T>>;
    threshold?: number;
    keepDiacritics?: boolean;
}

/**
 * Takes an array of items and a value and returns a new array with the items that match the given value
 * @param items - the items to sort
 * @param value - the value to use for ranking
 * @param options - Some options to configure the sorter
 * @return the new sorted array
 */
declare function matchSorter<T>(
    items: ReadonlyArray<T>,
    value: string,
    options?: Options<T>
): T[];

export = matchSorter;
{'fraction_non_alphanumeric': 0.11550468262226847, 'fraction_numerical': 0.008324661810613945, 'mean_word_length': 3.0335664335664334, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 29, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6412897', 'n_tokens_mistral': 944, 'n_tokens_neox': 896, 'n_words': 280}