@types/ramda
Version:
TypeScript definitions for ramda
1,000 lines (878 loc) • 120 kB
TypeScript
// Type definitions for ramda 0.27
// Project: https://ramdajs.com
// Definitions by: Scott O'Malley <https://github.com/TheHandsomeCoder>
// Erwin Poeze <https://github.com/donnut>
// Matt DeKrey <https://github.com/mdekrey>
// Stephen King <https://github.com/sbking>
// Alejandro Fernandez Haro <https://github.com/afharo>
// Vítor Castro <https://github.com/teves-castro>
// Jordan Quagliatini <https://github.com/1M0reBug>
// Simon Højberg <https://github.com/hojberg>
// Samson Keung <https://github.com/samsonkeung>
// Angelo Ocana <https://github.com/angeloocana>
// Rayner Pupo <https://github.com/raynerd>
// Nikita Moshensky <https://github.com/moshensky>
// Ethan Resnick <https://github.com/ethanresnick>
// Tomas Szabo <https://github.com/deftomat>
// Maciek Blim <https://github.com/blimusiek>
// Marcin Biernat <https://github.com/biern>
// Rayhaneh Banyassady <https://github.com/rayhaneh>
// Ryan McCuaig <https://github.com/rgm>
// Drew Wyatt <https://github.com/drewwyatt>
// John Ottenlips <https://github.com/jottenlips>
// Nitesh Phadatare <https://github.com/minitesh>
// Krantisinh Deshmukh <https://github.com/krantisinh>
// Pierre-Antoine Mills <https://github.com/pirix-gh>
// Aram Kharazyan <https://github.com/nemo108>
// Jituan Lin <https://github.com/jituanlin>
// Philippe Mills <https://github.com/Philippe-mills>
// Saul Mirone <https://github.com/Saul-Mirone>
// Nicholai Nissen <https://github.com/Nicholaiii>
// Mike Deverell <https://github.com/devrelm>
// Jorge Santana <https://github.com/LORDBABUINO>
// Mikael Couzic <https://github.com/couzic>
// Nikita Balikhin <https://github.com/NEWESTERS>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 4.2
import * as _ from "ts-toolbelt";
import {
Arity0Fn,
Arity1Fn,
Arity2Fn,
AssocPartialOne,
ComposeWithFns,
Dictionary,
Evolvable,
Evolve,
Evolver,
Find,
Functor,
KeyValuePair,
Lens,
Merge,
MergeAll,
ObjectHavingSome,
ObjPred,
Ord,
Path,
Placeholder,
Pred,
PipeWithFns,
Reduced,
SafePred,
ValueOfRecord,
ValueOfUnion,
} from "./tools";
export * from './tools';
/**
* Placeholder. When used with functions like curry, or op, the second argument is applied to the second
* position, and it returns a function waiting for its first argument.
*/
export const __: Placeholder; /* This is used in examples throughout the docs, but I it only seems to be directly explained here: https://ramdajs.com/0.9/docs/#op */
/**
* Adds two numbers. Equivalent to a + b but curried.
*/
export function add(a: number, b: number): number;
export function add(a: number): (b: number) => number;
/**
* Creates a new list iteration function from an existing one by adding two new parameters to its callback
* function: the current index, and the entire list.
*/
export function addIndex<T, U>(fn: (f: (item: T) => U, list: readonly T[]) => U[]): _.F.Curry<(a: (item: T, idx: number, list?: T[]) => U, b: readonly T[]) => U[]>;
/* Special case for forEach */
export function addIndex<T>(fn: (f: (item: T) => void, list: readonly T[]) => T[]): _.F.Curry<(a: (item: T, idx: number, list?: T[]) => void, b: readonly T[]) => T[]>;
/* Special case for reduce */
export function addIndex<T, U>(fn: (f: (acc: U, item: T) => U, aci: U, list: readonly T[]) => U): _.F.Curry<(a: (acc: U, item: T, idx: number, list?: T[]) => U, b: U, c: readonly T[]) => U>;
/**
* Applies a function to the value at the given index of an array, returning a new copy of the array with the
* element at the given index replaced with the result of the function application.
*/
export function adjust<T>(index: number, fn: (a: T) => T, list: readonly T[]): T[];
export function adjust<T>(index: number, fn: (a: T) => T): (list: readonly T[]) => T[];
/**
* Returns true if all elements of the list match the predicate, false if there are any that don't.
*/
export function all<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
export function all<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
/**
* Given a list of predicates, returns a new predicate that will be true exactly when all of them are.
*/
export function allPass(preds: readonly Pred[]): Pred;
/**
* Returns a function that always returns the given value.
*/
export function always<T>(val: T): () => T;
/**
* A function that returns the first argument if it's falsy otherwise the second argument. Note that this is
* NOT short-circuited, meaning that if expressions are passed they are both evaluated.
*/
export function and<T extends { and?: ((...a: readonly any[]) => any) | undefined; } | number | boolean | string | null>(fn1: T, val2: any): boolean;
export function and<T extends { and?: ((...a: readonly any[]) => any) | undefined; } | number | boolean | string | null>(fn1: T): (val2: any) => boolean;
/**
* Returns the result of applying the onSuccess function to the value inside a successfully resolved promise. This is useful for working with promises inside function compositions.
*/
export function andThen<A, B>(onSuccess: (a: A) => B | Promise<B>, promise: Promise<A>): Promise<B>;
export function andThen<A, B>(onSuccess: (a: A) => B | Promise<B>): (promise: Promise<A>) => Promise<B>;
/**
* Returns true if at least one of elements of the list match the predicate, false otherwise.
*/
export function any<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
export function any<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
/**
* Given a list of predicates returns a new predicate that will be true exactly when any one of them is.
*/
export function anyPass<T>(preds: Array<SafePred<T>>): SafePred<T>;
/**
* ap applies a list of functions to a list of values.
*/
export function ap<T, U>(fns: Array<((a: T) => U)>, vs: readonly T[]): U[];
export function ap<T, U>(fns: Array<((a: T) => U)>): (vs: readonly T[]) => U[];
export function ap<X0, X1, R>(
fn: (x1: X1, x0: X0) => R,
fn1: (x1: X1) => X0
): (x1: X1) => R;
/**
* Returns a new list, composed of n-tuples of consecutive elements If n is greater than the length of the list,
* an empty list is returned.
*/
export function aperture<T>(n: 1, list: readonly T[]): Array<[T]>;
export function aperture<T>(n: 2, list: readonly T[]): Array<[T, T]>;
export function aperture<T>(n: 3, list: readonly T[]): Array<[T, T, T]>;
export function aperture<T>(n: 4, list: readonly T[]): Array<[T, T, T, T]>;
export function aperture<T>(n: 5, list: readonly T[]): Array<[T, T, T, T, T]>;
export function aperture<T>(n: 6, list: readonly T[]): Array<[T, T, T, T, T, T]>;
export function aperture<T>(n: 7, list: readonly T[]): Array<[T, T, T, T, T, T, T]>;
export function aperture<T>(n: 8, list: readonly T[]): Array<[T, T, T, T, T, T, T, T]>;
export function aperture<T>(n: 9, list: readonly T[]): Array<[T, T, T, T, T, T, T, T, T]>;
export function aperture<T>(n: 10, list: readonly T[]): Array<[T, T, T, T, T, T, T, T, T, T]>;
export function aperture<T>(n: number, list: readonly T[]): T[][];
export function aperture(n: number): <T>(list: readonly T[]) => T[][];
/**
* Returns a new list containing the contents of the given list, followed by the given element.
*/
export function append<T>(el: T, list: readonly T[]): T[];
export function append<T>(el: T): <T>(list: readonly T[]) => T[];
/**
* Applies function fn to the argument list args. This is useful for creating a fixed-arity function from
* a variadic function. fn should be a bound function if context is significant.
*/
export function apply<T, U, TResult>(fn: (arg0: T, ...args: readonly T[]) => TResult, args: readonly U[]): TResult;
export function apply<T, TResult>(fn: (arg0: T, ...args: readonly T[]) => TResult): <U>(args: readonly U[]) => TResult;
/**
* Given a spec object recursively mapping properties to functions, creates a function producing an object
* of the same structure, by mapping each property to the result of calling its associated function with
* the supplied arguments.
*/
export function applySpec<Obj extends Record<string, (...args: readonly any[]) => any>>(
obj: Obj
): (
...args: Parameters<ValueOfRecord<Obj>>
) => { [Key in keyof Obj]: ReturnType<Obj[Key]> };
export function applySpec<T>(obj: any): (...args: readonly any[]) => T;
/**
* Takes a value and applies a function to it.
* This function is also known as the thrush combinator.
*/
export function applyTo<T, U>(el: T, fn: (t: T) => U): U;
export function applyTo<T>(el: T): <U>(fn: (t: T) => U) => U;
/**
* Makes an ascending comparator function out of a function that returns a value that can be compared with < and >.
*/
export function ascend<T>(fn: (obj: T) => any, a: T, b: T): number;
export function ascend<T>(fn: (obj: T) => any): (a: T, b: T) => number;
/**
* Makes a shallow clone of an object, setting or overriding the specified property with the given value.
*/
export function assoc<T, U>(__: Placeholder, val: T, obj: U): <K extends string>(prop: K) => Record<K, T> & Omit<U, K>;
export function assoc<U, K extends string>(prop: K, __: Placeholder, obj: U): <T>(val: T) => Record<K, T> & Omit<U, K>;
export function assoc<T, U, K extends string>(prop: K, val: T, obj: U): Record<K, T> & Omit<U, K>;
export function assoc<T, K extends string>(prop: K, val: T): <U>(obj: U) => Record<K, T> & Omit<U, K>;
export function assoc<K extends string>(prop: K): AssocPartialOne<K>;
/**
* Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and
* placing the specific value at the tail end of that path.
*/
export function assocPath<T, U>(__: Placeholder, val: T, obj: U): (path: Path) => U;
export function assocPath<T, U>(path: Path, __: Placeholder, obj: U): (val: T) => U;
export function assocPath<T, U>(path: Path, val: T, obj: U): U;
export function assocPath<T, U>(path: Path, val: T): (obj: U) => U;
export function assocPath<T, U>(path: Path): _.F.Curry<(a: T, b: U) => U>;
/**
* Wraps a function of any arity (including nullary) in a function that accepts exactly 2
* parameters. Any extraneous parameters will not be passed to the supplied function.
*/
export function binary<T extends (...arg: any) => any>(fn: T): (...arg: _.T.Take<Parameters<T>, '2'>) => ReturnType<T>;
/**
* Creates a function that is bound to a context. Note: R.bind does not provide the additional argument-binding
* capabilities of Function.prototype.bind.
*/
export function bind<F extends (...args: readonly any[]) => any, T>(fn: F, thisObj: T): (...args: Parameters<F>) => ReturnType<F>;
export function bind<F extends (...args: readonly any[]) => any, T>(fn: F): (thisObj: T) => (...args: Parameters<F>) => ReturnType<F>;
/**
* A function wrapping calls to the two functions in an && operation, returning the result of the first function
* if it is false-y and the result of the second function otherwise. Note that this is short-circuited, meaning
* that the second function will not be invoked if the first returns a false-y value.
*/
export function both(pred1: Pred, pred2: Pred): Pred;
export function both(pred1: Pred): (pred2: Pred) => Pred;
/**
* Returns the result of calling its first argument with the remaining arguments. This is occasionally useful
* as a converging function for R.converge: the left branch can produce a function while the right branch
* produces a value to be passed to that function as an argument.
*/
export function call(fn: (...args: readonly any[]) => (...args: readonly any[]) => any, ...args: readonly any[]): any;
/**
* `chain` maps a function over a list and concatenates the results.
* This implementation is compatible with the Fantasy-land Chain spec
*/
export function chain<T, U>(fn: (n: T) => readonly U[], list: readonly T[]): U[];
export function chain<T, U>(fn: (n: T) => readonly U[]): (list: readonly T[]) => U[];
export function chain<X0, X1, R>(fn: (x0: X0) => (x1: X1) => R, fn1: (x1: X1) => X0): (x1: X1) => R;
/**
* Restricts a number to be within a range.
* Also works for other ordered types such as Strings and Date
*/
export function clamp<T>(min: T, max: T, value: T): T;
export function clamp<T>(min: T, max: T): (value: T) => T;
export function clamp<T>(min: T): (max: T, value: T) => T;
export function clamp<T>(min: T): (max: T) => (value: T) => T;
/**
* Creates a deep copy of the value which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates.
*/
export function clone<T>(value: T): T;
export function clone<T>(value: readonly T[]): T[];
/**
* Makes a comparator function out of a function that reports whether the first element is less than the second.
*/
// comparator(pred: (a: any, b: any) => boolean): (x: number, y: number) => number;
export function comparator<T>(pred: (a: T, b: T) => boolean): (x: T, y: T) => number;
/**
* Takes a function f and returns a function g such that:
* - applying g to zero or more arguments will give true if applying the same arguments to f gives
* a logical false value; and
* - applying g to zero or more arguments will give false if applying the same arguments to f gives
* a logical true value.
*/
export function complement<As extends any[]>(pred: (...args: As) => boolean): (...args: As) => boolean;
/**
* Performs right-to-left function composition. The rightmost function may have any arity; the remaining
* functions must be unary.
*/
// generic rest parameters in TS 3.0 allows writing a single variant for any number of Vx
// compose<V extends unknown[], T1>(fn0: (...args: V) => T1): (...args: V) => T1;
// compose<V extends unknown[], T1, T2>(fn1: (x: T1) => T2, fn0: (...args: V) => T1): (...args: V) => T2;
// but requiring TS>=3.0 sounds like a breaking change, so just leaving a comment for the future
// tslint:disable:max-line-length
export function compose<T1>(fn0: () => T1): () => T1;
export function compose<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
export function compose<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
export function compose<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1;
export function compose<T1, T2>(fn1: (x: T1) => T2, fn0: () => T1): () => T2;
export function compose<V0, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T2;
export function compose<V0, V1, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T2;
export function compose<V0, V1, V2, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T2;
export function compose<T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T3;
export function compose<V0, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T3;
export function compose<V0, V1, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T3;
export function compose<V0, V1, V2, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T3;
export function compose<T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T4;
export function compose<V0, T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T4;
export function compose<V0, V1, T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T4;
export function compose<V0, V1, V2, T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T4;
export function compose<T1, T2, T3, T4, T5>(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T5;
export function compose<V0, T1, T2, T3, T4, T5>(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T5;
export function compose<V0, V1, T1, T2, T3, T4, T5>(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T5;
export function compose<V0, V1, V2, T1, T2, T3, T4, T5>(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T5;
export function compose<T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T6;
export function compose<V0, T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T6;
export function compose<V0, V1, T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T6;
export function compose<V0, V1, V2, T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T6;
// tslint:enable:max-line-length
/**
* Returns the right-to-left Kleisli composition of the provided functions, each of which must return a value of a type supported by chain.
* The typings only support arrays for now.
* All functions must be unary.
* R.composeK(h, g, f) is equivalent to R.compose(R.chain(h), R.chain(g), f).
*
* @deprecated since 0.26 in favor of composeWith(chain)
*/
// tslint:disable:max-line-length
export function composeK<V0, T1>(fn0: (x0: V0) => T1[]): (x0: V0) => T1[];
export function composeK<V0, T1, T2>(fn1: (x: T1) => T2[], fn0: (x0: V0) => T1[]): (x0: V0) => T2[];
export function composeK<V0, T1, T2, T3>(fn2: (x: T2) => T3[], fn1: (x: T1) => T2[], fn0: (x: V0) => T1[]): (x: V0) => T3[];
export function composeK<V0, T1, T2, T3, T4>(fn3: (x: T3) => T4[], fn2: (x: T2) => T3[], fn1: (x: T1) => T2[], fn0: (x: V0) => T1[]): (x: V0) => T4[];
export function composeK<V0, T1, T2, T3, T4, T5>(fn4: (x: T4) => T5[], fn3: (x: T3) => T4[], fn2: (x: T2) => T3[], fn1: (x: T1) => T2[], fn0: (x: V0) => T1[]): (x: V0) => T5[];
export function composeK<V0, T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => T6[], fn4: (x: T4) => T5[], fn3: (x: T3) => T4[], fn2: (x: T2) => T3[], fn1: (x: T1) => T2[], fn0: (x: V0) => T1[]): (x: V0) => T6[];
// tslint:enable:max-line-length
/**
* Performs right-to-left composition of one or more Promise-returning functions.
* All functions must be unary.
*
* @deprecated since 0.26 in favor of composeWith(then)
*/
// tslint:disable:max-line-length
export function composeP<V0, T1>(fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T1>;
export function composeP<V0, T1, T2>(fn1: (x: T1) => Promise<T2>, fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T2>;
export function composeP<V0, T1, T2, T3>(fn2: (x: T2) => Promise<T3>, fn1: (x: T1) => Promise<T2>, fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T3>;
export function composeP<V0, T1, T2, T3, T4>(fn3: (x: T3) => Promise<T4>, fn2: (x: T2) => Promise<T3>, fn1: (x: T1) => Promise<T2>, fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T4>;
export function composeP<V0, T1, T2, T3, T4, T5>(fn4: (x: T4) => Promise<T5>, fn3: (x: T3) => Promise<T4>, fn2: (x: T2) => Promise<T3>, fn1: (x: T1) => Promise<T2>, fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T5>;
export function composeP<V0, T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => Promise<T6>, fn4: (x: T4) => Promise<T5>, fn3: (x: T3) => Promise<T4>, fn2: (x: T2) => Promise<T3>, fn1: (x: T1) => Promise<T2>, fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T6>;
// tslint:enable:max-line-length
/**
* Performs right-to-left function composition using transforming function.
* With the current typings, all functions must be unary.
*/
export function composeWith<V0, T>(composer: (...args: any[]) => any, fns: ComposeWithFns<V0, T>): (x0: V0) => T;
export function composeWith(composer: (...args: any[]) => any): <V0, T>(fns: ComposeWithFns<V0, T>) => (x: V0) => T;
/**
* Returns the result of concatenating the given lists or strings.
*/
export function concat(
placeholder: Placeholder,
): (<L1 extends any[], L2 extends any[]>(list1: L1, list2: L2) => [...L1, ...L2]) &
(<S1 extends string, S2 extends string>(s1: S1, s2: S2) => `${S1}${S2}`);
export function concat<L2 extends any[]>(placeholder: Placeholder, list2: L2): <L1 extends any[]>(list1: L1) => [...L1, ...L2];
export function concat<S2 extends string>(placeholder: Placeholder, s2: S2): <S1 extends string>(s1: S1) => `${S1}${S2}`;
export function concat<L1 extends any[]>(list1: L1): <L2 extends any[]>(list2: L2) => [...L1, ...L2];
export function concat<S1 extends string>(s1: S1): <S2 extends string>(s2: S2) => `${S1}${S2}`;
export function concat<L1 extends any[], L2 extends any[]>(list1: L1, list2: L2): [...L1, ...L2];
export function concat<S1 extends string, S2 extends string>(s1: S1, s2: S2): `${S1}${S2}`;
export function concat(s1: string, s2: string): string;
export function concat(s1: string): (s2: string) => string;
/**
* Returns a function, fn, which encapsulates if/else-if/else logic. R.cond takes a list of [predicate, transform] pairs.
* All of the arguments to fn are applied to each of the predicates in turn until one returns a "truthy" value, at which
* point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates
* matches, fn returns undefined.
*/
export function cond(fns: Array<[Pred, (...a: readonly any[]) => any]>): (...a: readonly any[]) => any;
export function cond<A, B>(fns: Array<[SafePred<A>, (...a: readonly A[]) => B]>): (...a: readonly A[]) => B;
/**
* Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type.
*/
export function construct<A extends any[], T>(constructor: { new(...a: A): T } | ((...a: A) => T)): (...a: A) => T;
/**
* Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type.
* The arity of the function returned is specified to allow using variadic constructor functions.
*/
export function constructN<A extends any[], T>(n: number, constructor: { new(...a: A): T } | ((...a: A) => T)): (...a: Partial<A>) => T;
/**
* Returns `true` if the specified item is somewhere in the list, `false` otherwise.
* Equivalent to `indexOf(a)(list) > -1`. Uses strict (`===`) equality checking.
*
* @deprecated since 0.26 in favor of includes
*/
export function contains(__: Placeholder, list: string): (a: string) => boolean;
export function contains<T>(__: Placeholder, list: readonly T[]): (a: T) => boolean;
export function contains(__: Placeholder): (list: string, a: string) => boolean;
export function contains<T>(__: Placeholder): (list: readonly T[], a: T) => boolean;
export function contains(a: string, list: string): boolean;
export function contains<T>(a: T, list: readonly T[]): boolean;
export function contains(a: string): (list: string) => boolean;
export function contains<T>(a: T): (list: readonly T[]) => boolean;
/**
* Accepts a converging function and a list of branching functions and returns a new
* function. When invoked, this new function is applied to some arguments, each branching
* function is applied to those same arguments. The results of each branching function
* are passed as arguments to the converging function to produce the return value.
*/
export function converge(after: ((...a: readonly any[]) => any), fns: Array<((...a: readonly any[]) => any)>): (...a: readonly any[]) => any;
/**
* Counts the elements of a list according to how many match each value
* of a key generated by the supplied function. Returns an object
* mapping the keys produced by `fn` to the number of occurrences in
* the list. Note that all keys are coerced to strings because of how
* JavaScript objects work.
*/
export function countBy<T>(fn: (a: T) => string | number, list: readonly T[]): { [index: string]: number };
export function countBy<T>(fn: (a: T) => string | number): (list: readonly T[]) => { [index: string]: number };
/**
* Returns a curried equivalent of the provided function. The curried function has two unusual capabilities.
* First, its arguments needn't be provided one at a time.
*/
export function curry<F extends (...args: any) => any>(f: F): _.F.Curry<F>;
/**
* Returns a curried equivalent of the provided function, with the specified arity. The curried function has
* two unusual capabilities. First, its arguments needn't be provided one at a time.
*/
export function curryN<N extends number, F extends (...args: any) => any>(length: N, fn: F): _.F.Curry<(...a: _.T.Take<Parameters<F>, _.N.NumberOf<N>>) => ReturnType<F>>;
export function curryN<N extends number>(length: N): <F extends (...args: any) => any>(fn: F) => _.F.Curry<(...a: _.T.Take<Parameters<F>, _.N.NumberOf<N>>) => ReturnType<F>>;
/**
* Decrements its argument.
*/
export function dec(n: number): number;
/**
* Returns the second argument if it is not null or undefined. If it is null or undefined, the
* first (default) argument is returned.
*/
export function defaultTo<T, U>(a: T, b: U | null | undefined): T | U;
export function defaultTo<T>(a: T): <U>(b: U | null | undefined) => T | U;
/**
* Makes a descending comparator function out of a function that returns a value that can be compared with < and >.
*/
export function descend<T>(fn: (obj: T) => any, a: T, b: T): number;
export function descend<T>(fn: (obj: T) => any): (a: T, b: T) => number;
/**
* Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list.
*/
export function difference<T>(list1: readonly T[], list2: readonly T[]): T[];
export function difference<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
/**
* Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list.
* Duplication is determined according to the value returned by applying the supplied predicate to two list
* elements.
*/
export function differenceWith<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[], list2: readonly T2[]): T1[];
export function differenceWith<T1, T2>(pred: (a: T1, b: T2) => boolean): (list1: readonly T1[], list2: readonly T2[]) => T1[];
export function differenceWith<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[]): (list2: readonly T2[]) => T1[];
/*
* Returns a new object that does not contain a prop property.
*/
export function dissoc<T extends object, K extends keyof T>(prop: K, obj: T): Omit<T, K>;
export function dissoc<K extends string | number>(prop: K): <T extends object>(obj: T) => Omit<T, K>;
/**
* Makes a shallow clone of an object, omitting the property at the given path.
*/
export function dissocPath<T>(path: Path, obj: any): T;
export function dissocPath<T>(path: Path): (obj: any) => T;
/**
* Divides two numbers. Equivalent to a / b.
*/
export function divide(__: Placeholder, b: number): (a: number) => number;
export function divide(__: Placeholder): (b: number, a: number) => number;
export function divide(a: number, b: number): number;
export function divide(a: number): (b: number) => number;
/**
* Returns a new list containing all but the first n elements of the given list.
*/
export function drop<T>(n: number, xs: readonly T[]): T[];
export function drop(n: number, xs: string): string;
export function drop<T>(n: number): {
(xs: string): string;
(xs: readonly T[]): T[];
};
/**
* Returns a list containing all but the last n elements of the given list.
*/
export function dropLast<T>(n: number, xs: readonly T[]): T[];
export function dropLast(n: number, xs: string): string;
export function dropLast<T>(n: number): {
(xs: readonly T[]): T[];
(xs: string): string;
};
/**
* Returns a new list containing all but last then elements of a given list, passing each value from the
* right to the supplied predicate function, skipping elements while the predicate function returns true.
*/
export function dropLastWhile<T>(fn: (a: T) => boolean, list: readonly T[]): T[];
export function dropLastWhile<T>(fn: (a: T) => boolean): (list: readonly T[]) => T[];
/**
* Returns a new list without any consecutively repeating elements. R.equals is used to determine equality.
*/
export function dropRepeats<T>(list: readonly T[]): T[];
/**
* Returns a new list without any consecutively repeating elements.
* Equality is determined by applying the supplied predicate to each pair of consecutive elements.
* The first element in a series of equal elements will be preserved.
*/
export function dropRepeatsWith<T>(predicate: (left: T, right: T) => boolean, list: readonly T[]): T[];
export function dropRepeatsWith<T>(predicate: (left: T, right: T) => boolean): (list: readonly T[]) => T[];
/**
* Returns a new list containing the last n elements of a given list, passing each value to the supplied
* predicate function, skipping elements while the predicate function returns true.
*/
export function dropWhile<T>(fn: (a: T) => boolean, list: readonly T[]): T[];
export function dropWhile<T>(fn: (a: T) => boolean): (list: readonly T[]) => T[];
/**
* A function wrapping calls to the two functions in an || operation, returning the result of the first
* function if it is truth-y and the result of the second function otherwise. Note that this is
* short-circuited, meaning that the second function will not be invoked if the first returns a truth-y value.
*/
export function either(pred1: Pred, pred2: Pred): Pred;
export function either(pred1: Pred): (pred2: Pred) => Pred;
/**
* Returns the empty value of its argument's type. Ramda defines the empty value of Array ([]), Object ({}),
* String (''), and Arguments. Other types are supported if they define <Type>.empty and/or <Type>.prototype.empty.
* Dispatches to the empty method of the first argument, if present.
*/
export function empty<T>(x: T): T;
/**
* Checks if a list ends with the provided values
*/
export function endsWith(a: string, list: string): boolean;
export function endsWith(a: string): (list: string) => boolean;
export function endsWith<T>(a: T | readonly T[], list: readonly T[]): boolean;
export function endsWith<T>(a: T | readonly T[]): (list: readonly T[]) => boolean;
/**
* Takes a function and two values in its domain and returns true if the values map to the same value in the
* codomain; false otherwise.
*/
export function eqBy<T, U = T>(fn: (a: T) => U, a: T, b: T): boolean;
export function eqBy<T, U = T>(fn: (a: T) => U, a: T): (b: T) => boolean;
export function eqBy<T, U = T>(fn: (a: T) => U): _.F.Curry<(a: T, b: T) => boolean>;
/**
* Reports whether two functions have the same value for the specified property.
*/
export function eqProps<T, U>(prop: string, obj1: T, obj2: U): boolean;
export function eqProps<P extends string>(prop: P): <T, U>(obj1: Record<P, T>, obj2: Record<P, U>) => boolean;
export function eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;
/**
* Returns true if its arguments are equivalent, false otherwise. Dispatches to an equals method if present.
* Handles cyclical data structures.
*/
export function equals<T>(__: Placeholder, b: T): (a: T) => boolean;
export function equals<T>(a: T, b: T): boolean;
export function equals<T>(a: T): (b: T) => boolean;
/**
* Creates a new object by evolving a shallow copy of object, according to the transformation functions.
*/
export function evolve<E extends Evolver, V extends Evolvable<E>>(transformations: E, obj: V): Evolve<V, E>;
export function evolve<E extends Evolver>(transformations: E): <V extends Evolvable<E>>(obj: V) => Evolve<V, E>;
/*
* A function that always returns false. Any passed in parameters are ignored.
*/
export function F(): boolean;
/**
* Returns a new list containing only those items that match a given predicate function. The predicate function is passed one argument: (value).
*/
export function filter<A, P extends A>(pred: (val: A) => val is P): {
<B extends A>(list: readonly B[]): P[];
<B extends A>(dict: Dictionary<B>): Dictionary<P>;
};
export function filter<T>(pred: (value: T) => boolean): <P extends T, C extends (readonly P[] | Dictionary<P>)>(collection: C) => C;
export function filter<T, P extends T>(pred: (val: T) => val is P, list: readonly T[]): P[];
export function filter<T, P extends T>(pred: (val: T) => val is P, dict: Dictionary<T>): Dictionary<P>;
export function filter<T, C extends (readonly T[] | Dictionary<T>)>(pred: (value: T) => boolean, collection: C): C;
/**
* Returns the first element of the list which matches the predicate, or `undefined` if no
* element matches.
*/
export const find: Find;
/**
* Returns the index of the first element of the list which matches the predicate, or `-1`
* if no element matches.
*/
export function findIndex<T>(fn: (a: T) => boolean, list: readonly T[]): number;
export function findIndex<T>(fn: (a: T) => boolean): (list: readonly T[]) => number;
/**
* Returns the last element of the list which matches the predicate, or `undefined` if no
* element matches.
*/
export const findLast: Find;
/**
* Returns the index of the last element of the list which matches the predicate, or
* `-1` if no element matches.
*/
export function findLastIndex<T>(fn: (a: T) => boolean, list: readonly T[]): number;
export function findLastIndex<T>(fn: (a: T) => boolean): (list: readonly T[]) => number;
/**
* Returns a new list by pulling every item out of it (and all its sub-arrays) and putting
* them in a new array, depth-first.
*/
export function flatten<T extends readonly any[]>(list: T): _.T.Flatten<T>;
/**
* Returns a new function much like the supplied one, except that the first two arguments'
* order is reversed.
*/
export function flip<T, U, TResult>(fn: (arg0: T, arg1: U) => TResult): (arg1: U, arg0?: T) => TResult;
export function flip<F extends (...args: any) => any, P extends _.F.Parameters<F>>(fn: F): _.F.Curry<(...args: _.T.Merge<[P[1], P[0]], P>) => _.F.Return<F>>;
/**
* Iterate over an input list, calling a provided function fn for each element in the list.
*/
export function forEach<T>(fn: (x: T) => void, list: readonly T[]): T[];
export function forEach<T>(fn: (x: T) => void): (list: readonly T[]) => T[];
export function forEach<T>(fn: (x: T) => void, list: readonly T[]): T[];
export function forEach<T>(fn: (x: T) => void): (list: readonly T[]) => T[];
/**
* Iterate over an input object, calling a provided function fn for each key and value in the object.
*/
export function forEachObjIndexed<T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void, obj: T): T;
export function forEachObjIndexed<T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void): (obj: T) => T;
/**
* Creates a new object out of a list key-value pairs.
*/
export function fromPairs<V>(pairs: Array<KeyValuePair<string, V>> | Array<KeyValuePair<number, V>>): { [index: string]: V };
/**
* Splits a list into sublists stored in an object, based on the result of
* calling a String-returning function
* on each element, and grouping the results according to values returned.
*/
export function groupBy<T, K extends string = string>(fn: (a: T) => K, list: readonly T[]): Record<K, T[]>;
export function groupBy<T, K extends string = string>(fn: (a: T) => K): (list: readonly T[]) => Record<K, T[]>;
/**
* Takes a list and returns a list of lists where each sublist's elements are all "equal" according to the provided equality function
*/
export function groupWith<T>(fn: (x: T, y: T) => boolean): (list: readonly T[]) => T[][];
export function groupWith<T>(fn: (x: T, y: T) => boolean, list: readonly T[]): T[][];
export function groupWith<T>(fn: (x: T, y: T) => boolean, list: string): string[];
/**
* Returns true if the first parameter is greater than the second.
*/
export function gt(__: Placeholder, b: number): (a: number) => boolean;
export function gt(__: Placeholder): (b: number, a: number) => boolean;
export function gt(a: number, b: number): boolean;
export function gt(a: string, b: string): boolean;
export function gt(a: number): (b: number) => boolean;
/**
* Returns true if the first parameter is greater than or equal to the second.
*/
export function gte(__: Placeholder, b: number): (a: number) => boolean;
export function gte(__: Placeholder): (b: number, a: number) => boolean;
export function gte(a: number, b: number): boolean;
export function gte(a: string, b: string): boolean;
export function gte(a: number): (b: number) => boolean;
/**
* Returns whether or not an object has an own property with the specified name.
*/
export function has(__: Placeholder, obj: unknown): (s: string) => boolean;
export function has(__: Placeholder): <P extends string>(obj: unknown, s: P) => obj is ObjectHavingSome<P>;
export function has<P extends string>(s: P, obj: unknown): obj is ObjectHavingSome<P>;
export function has<P extends string>(s: P): (obj: unknown) => obj is ObjectHavingSome<P>;
/**
* Returns whether or not an object or its prototype chain has a property with the specified name
*/
export function hasIn<T>(s: string, obj: T): boolean;
export function hasIn(s: string): <T>(obj: T) => boolean;
/**
* Returns whether or not a path exists in an object. Only the object's own properties are checked.
*/
export function hasPath<T>(list: readonly string[], obj: T): boolean;
export function hasPath(list: readonly string[]): <T>(obj: T) => boolean;
/**
* Returns the first element in a list.
* In some libraries this function is named `first`.
*/
export function head(str: string): string;
export function head(list: readonly []): undefined;
export function head<T extends any>(list: readonly T[]): T | undefined;
/**
* Returns true if its arguments are identical, false otherwise. Values are identical if they reference the
* same memory. NaN is identical to NaN; 0 and -0 are not identical.
*/
export function identical<T>(a: T, b: T): boolean;
export function identical<T>(a: T): (b: T) => boolean;
/**
* A function that does nothing but return the parameter supplied to it. Good as a default
* or placeholder function.
*/
export function identity<T>(a: T): T;
/**
* Creates a function that will process either the onTrue or the onFalse function depending upon the result
* of the condition predicate.
*/
export function ifElse(fn: Pred, onTrue: Arity1Fn, onFalse: Arity1Fn): Arity1Fn;
export function ifElse(fn: Pred, onTrue: Arity2Fn, onFalse: Arity2Fn): Arity2Fn;
/**
* Increments its argument.
*/
export function inc(n: number): number;
/**
* Given a target, this function checks a list for the target and returns a boolean.
* Given a string, this function checks for the string in another string or list and returns
* a boolean.
*/
export function includes(__: Placeholder, list: readonly string[] | string): (s: string) => boolean;
export function includes<T>(__: Placeholder, list: readonly T[]): (target: T) => boolean;
export function includes(__: Placeholder): (list: readonly string[] | string, s: string) => boolean;
export function includes<T>(__: Placeholder): (list: readonly T[], target: T) => boolean;
export function includes(s: string, list: readonly string[] | string): boolean;
export function includes(s: string): (list: readonly string[] | string) => boolean;
export function includes<T>(target: T, list: readonly T[]): boolean;
export function includes<T>(target: T): (list: readonly T[]) => boolean;
/**
* Given a function that generates a key, turns a list of objects into an object indexing the objects
* by the given key.
*/
export function indexBy<T, K extends string | number = string>(fn: (a: T) => K, list: readonly T[]): { [key in K]: T };
export function indexBy<T, K extends string | number | undefined = string>(fn: (a: T) => K, list: readonly T[]): { [key in NonNullable<K>]?: T };
export function indexBy<T, K extends string | number = string>(fn: (a: T) => K): (list: readonly T[]) => { [key in K]: T };
export function indexBy<T, K extends string | number | undefined = string>(fn: (a: T) => K | undefined): (list: readonly T[]) => { [key in NonNullable<K>]?: T };
/**
* Returns the position of the first occurrence of an item in an array
* (by strict equality),
* or -1 if the item is not included in the array.
*/
export function indexOf<T>(target: T, list: readonly T[]): number;
export function indexOf<T>(target: T): (list: readonly T[]) => number;
/**
* Returns all but the last element of a list or string.
*/
export function init<T>(list: readonly T[]): T[];
export function init(list: string): string;
/**
* Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list
* `xs'` comprising each of the elements of `xs` which is equal to one or more
* elements of `ys` according to `pred`.
*
* `pred` must be a binary function expecting an element from each list.
*
* `xs`, `ys`, and `xs'` are treated as sets, semantically, so ordering should
* not be significant, but since `xs'` is ordered the implementation guarantees
* that its values are in the same order as they appear in `xs`. Duplicates are
* not removed, so `xs'` may contain duplicates if `xs` contains duplicates.
*/
export function innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[], list2: readonly T2[]): T1[];
export function innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean): (list1: readonly T1[], list2: readonly T2[]) => T1[];
export function innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[]): (list2: readonly T2[]) => T1[];
/**
* Inserts the supplied element into the list, at index index. Note that
* this is not destructive: it returns a copy of the list with the changes.
*/
export function insert<T>(index: number, elt: T, list: readonly T[]): T[];
export function insert<T>(index: number, elt: T): (list: readonly T[]) => T[];
export function insert(index: number): <T>(elt: T, list: readonly T[]) => T[];
/**
* Inserts the sub-list into the list, at index `index`. _Note that this
* is not destructive_: it returns a copy of the list with the changes.
*/
export function insertAll<T>(index: number, elts: readonly T[], list: readonly T[]): T[];
export function insertAll<T>(index: number, elts: readonly T[]): (list: readonly T[]) => T[];
export function insertAll(index: number): <T>(elts: readonly T[], list: readonly T[]) => T[];
/**
* Combines two lists into a set (i.e. no duplicates) composed of those elements common to both lists.
*/
export function intersection<T>(list1: readonly T[], list2: readonly T[]): T[];
export function intersection<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
/**
* Creates a new list with the separator interposed between elements.
*/
export function intersperse<T>(separator: T, list: readonly T[]): T[];
export function intersperse<T>(separator: T): (list: readonly T[]) => T[];
/**
* Transforms the items of the list with the transducer and appends the transformed items to the accumulator
* using an appropriate iterator function based on the accumulator type.
*/
export function into<T>(acc: any, xf: (...a: readonly any[]) => any, list: readonly T[]): T[];
export function into<T, R>(acc: any, xf: (...a: readonly any[]) => R[], list: readonly T[]): R[];
export function into(acc: any, xf: (...a: readonly any[]) => any): <T>(list: readonly T[]) => T[];
export function into(acc: any): <T>(xf: (...a: readonly any[]) => any, list: readonly T[]) => T[];
/**
* Same as R.invertObj, however this accounts for objects with duplicate values by putting the values into an array.
*/
export function invert<T>(obj: T): { [index: string]: string[] };
/**
* Returns a new object with the keys of the given object as values, and the values of the given object as keys.
*/
export function invertObj(obj: { [index: string]: string } | { [index: number]: string }): { [index: string]: string };
/**
* Turns a named method with a specified arity into a function that can be called directly
* supplied with arguments and a target object.
*
* The returned function is curried and accepts `arity + 1` parameters where the final
* parameter is the target object.
*/
export function invoker(arity: number, method: string): (...a: readonly any[]) => any;
/**
* See if an object (`val`) is an instance of the supplied constructor.
* This function will check up the inheritance chain, if any.
*/
export function is<C extends (...args: any[]) => any>(ctor: C, val: any): val is ReturnType<C>;
export function is<C extends new (...args: any[]) => any>(ctor: C, val: any): val is InstanceType<C>;
export function is<C extends (...args: any[]) => any>(ctor: C): (val: any) => val is ReturnType<C>;
export function is<C extends new (...args: any[]) => any>(ctor: C): (val: any) => val is InstanceType<C>;
/**
* Reports whether the list has zero elements.
*/
export function isEmpty(value: any): boolean;
/**
* Checks if the input value is null or undefined.
*/
export function isNil(value: any): value is null | undefined;
/**
* Returns a string made by inserting the `separator` between each
* element and concatenating all the elements into a single string.
*/
export function join(x: string, xs: readonly any[]): string;
export function join(x: string): (xs: readonly any[]) => string;
/**
* Applies a list of functions to a list of values.
*/
export function juxt<A extends any[], R1, R2>(fns: [(...a: A) => R1, (...a: A) => R2]): (...a: A) => [R1, R2];
export function juxt<A extends any[], R1, R2, R3>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => [R1, R2, R3];
export function juxt<A extends any[], R1, R2, R3, R4>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => [R1, R2, R3, R4];
export function juxt<A extends any[], R1, R2, R3, R4, R5>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => [R1, R2, R3, R4, R5];
export function juxt<A extends any[], U>(fns: Array<(...args: A) => U>): (...args: A) => U[];
/**
* Returns a list containing the names of all the enumerable own
* properties of the supplied object.
*/
export function keys<T extends object>(x: T): Array<keyof T>;
export function keys<T>(x: T): string[];
/**
* Returns a list containing the names of all the
* properties of the supplied object, including prototype properties.
*/
export function keysIn<T>(obj: T): string[];
/**
* Returns the last element from a list.
*/
export function last(str: string): string;
export function last(list: readonly []): undefined;
export function last<T extends any>(list: readonly T[]): T | undefined;
/**
* Returns the position of the last occurrence of an item (by strict equality) in
* an array, or -1 if the item is not included in the array.
*/
export function lastIndexOf<T>(target: T, list: readonly T[]): number;
/**
* Returns the number of elements in the array by returning list.length.
*/
export function length<T>(list: readonly T[]): number;
/**
* Returns a lens for the given getter and setter functions. The getter
* "gets" the value of the focus; the setter "sets" the value of the focus.
* The setter should not mutate the data structure.
*/
export function lens<S, A>(getter: (s: S) => A, setter: (a: A, s: S) => S): Lens<S, A>;
/**
* Creates a lens that will focus on index n of the source array.
*/
export function lensIndex<A>(n: number): Lens<A[], A>;
export function lensIndex<A extends any[], N extends number>(n: N): Lens<A, A[N]>;
/**
* Returns a lens whose focus is the specified path.
* See also view, set, over.
*/
export function lensPath<S, K0 extends keyof S = keyof S>(path: [K0]): Lens<S, S[K0]>;
export function lensPath<S, K0 extends keyof S = keyof S, K1 extends keyof S[K0] = keyof S[K0]>(path: [K0, K1]): Lens<S, S[K0][K1]>;
export function lensPath<
S,
K0 extends keyof S = keyof S,
K1 extends keyof S[K0] = keyof S[K0],
K2 extends keyof S[K0][K1] = keyof S[K0][K1]
>(
path: [K0, K1, K2]
): Lens<S, S[K0][K1][K2]>;
export function lensPath<
S,
K0 extends keyof S = keyof S,
K1 extends keyof S[K0] = keyof S[K0],
K2 extends keyof S[K0][K1] = keyof S[K0][K1],
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
>(
path: [K0, K1, K2, K3]
): Lens<S, S[K0][K1][K2][K3]>;
export function lensPath<
S,
K0 extends keyof S = keyof S,
K1 extends keyof S[K0] = keyof S[K0],
K2 extends keyof S[K0][K1] = keyof S[K0][K1],
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],
>(
path: [K0, K1, K2, K3, K4]
): Lens<S, S[K0][K1][K2][K3][K4]>;
export function lensPath<
S,
K0 extends keyof S = keyof S,
K1 extends keyof S[K0] = keyof S[K0],
K2 extends keyof S[K0][K1] = keyof S[K0][K1],
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],
K5 extends keyof S[K0][K1][K2][K3][K4] = keyof S[K0][K1][K2][K3][K4],
>(
path: [K0, K1, K2, K3, K4, K5]
): Lens<S, S[K0][K1][K2][K3][K4][K5]>;
export function lensPath<S = any, A = any>(path: Path): Lens<S, A>;
/**
* lensProp creates a lens that will focus on property k o