declare type Partition = { (list: T[], predicate: (el: T) => el is S): [ S[], Exclude[] ]; (list: T, predicate: (el: any) => el is S): Part; (list: T[], predicate: (el: T) => unknown): [T[], T[]]; }; /** * Takes a `list` and returns a pair of lists containing: the elements that * match the `predicate` and those that don't, respectively. * * Think of it as `filter`, but the elements that don't pass the filter aren't * discarded but returned in a separate list instead. * * @example * ``` * const [strings, numbers] = partition( * ['a', 'b', 1, 'c', 2, 3], * (el): el is string => typeof el === 'string' * ) * // strings: ["a", "b", "c"] * // numbers: [1, 2, 3] * ``` */ declare const partition: Partition; export default partition; declare type Part = T extends readonly [ infer F, ...infer R ] ? [ F extends S ? [F, ...Part[0]] : Part[0], F extends S ? Part[1] : [F, ...Part[1]] ] : [[], []];