From b15f295909e8cc412aea89b256487d026dcd5683 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Mills Date: Mon, 16 Sep 2019 23:27:42 +0200 Subject: [PATCH] [ramda] allow arrays to be non-readonly (#38255) * allow arrays to be non-readonly * update ts-toolbelt * fix array types * fix array types * fix array types --- types/ramda/index.d.ts | 466 +++++++++++++++++++-------------------- types/ramda/package.json | 2 +- 2 files changed, 234 insertions(+), 234 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 2de19a4061..f5ef627080 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -556,7 +556,7 @@ declare namespace R { type Ord = number | string | boolean | Date; - type Path = ReadonlyArray<(number | string)>; + type Path = Array<(number | string)>; type KeyValuePair = [K, V]; @@ -602,15 +602,15 @@ declare namespace R { interface Filter { (fn: (value: T) => boolean): FilterOnceApplied; - (fn: (value: T) => boolean): (list: ReadonlyArray) => T[]; + (fn: (value: T) => boolean): (list: T[]) => T[]; (fn: (value: T) => boolean): (list: Dictionary) => Dictionary; - (fn: (value: T) => boolean, list: ReadonlyArray): T[]; + (fn: (value: T) => boolean, list: T[]): T[]; (fn: (value: T) => boolean, obj: Dictionary): Dictionary; } type FilterOnceApplied = - | Dictionary>(source: K) => - K extends ReadonlyArray ? U[] : + >(source: K) => + K extends Array ? U[] : K extends Dictionary ? Dictionary : never; @@ -810,29 +810,29 @@ declare namespace R { * 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. */ - addIndex(fn: (f: (item: T) => U, list: T[]) => U[]): F.Curry<(a: (item: T, idx: number, list?: T[]) => U, b: ReadonlyArray) => U[]>; + addIndex(fn: (f: (item: T) => U, list: T[]) => U[]): F.Curry<(a: (item: T, idx: number, list?: T[]) => U, b: T[]) => U[]>; /* Special case for forEach */ - addIndex(fn: (f: (item: T) => void, list: T[]) => T[]): F.Curry<(a: (item: T, idx: number, list?: T[]) => void, b: ReadonlyArray) => T[]>; + addIndex(fn: (f: (item: T) => void, list: T[]) => T[]): F.Curry<(a: (item: T, idx: number, list?: T[]) => void, b: T[]) => T[]>; /* Special case for reduce */ - addIndex(fn: (f: (acc: U, item: T) => U, aci: U, list: T[]) => U): F.Curry<(a: (acc: U, item: T, idx: number, list?: T[]) => U, b: U, c: ReadonlyArray) => U>; + addIndex(fn: (f: (acc: U, item: T) => U, aci: U, list: T[]) => U): F.Curry<(a: (acc: U, item: T, idx: number, list?: T[]) => U, b: U, c: 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. */ - adjust(index: number, fn: (a: T) => T, list: ReadonlyArray): T[]; - adjust(index: number, fn: (a: T) => T): (list: ReadonlyArray) => T[]; + adjust(index: number, fn: (a: T) => T, list: T[]): T[]; + adjust(index: number, fn: (a: T) => T): (list: T[]) => T[]; /** * Returns true if all elements of the list match the predicate, false if there are any that don't. */ - all(fn: (a: T) => boolean, list: ReadonlyArray): boolean; - all(fn: (a: T) => boolean): (list: ReadonlyArray) => boolean; + all(fn: (a: T) => boolean, list: T[]): boolean; + all(fn: (a: T) => boolean): (list: T[]) => boolean; /** * Given a list of predicates, returns a new predicate that will be true exactly when all of them are. */ - allPass(preds: ReadonlyArray): Pred; + allPass(preds: Pred[]): Pred; /** * Returns a function that always returns the given value. @@ -849,19 +849,19 @@ declare namespace R { /** * Returns true if at least one of elements of the list match the predicate, false otherwise. */ - any(fn: (a: T) => boolean, list: ReadonlyArray): boolean; - any(fn: (a: T) => boolean): (list: ReadonlyArray) => boolean; + any(fn: (a: T) => boolean, list: T[]): boolean; + any(fn: (a: T) => boolean): (list: T[]) => boolean; /** * Given a list of predicates returns a new predicate that will be true exactly when any one of them is. */ - anyPass(preds: ReadonlyArray>): SafePred; + anyPass(preds: Array>): SafePred; /** * ap applies a list of functions to a list of values. */ - ap(fns: Array<((a: T) => U)>, vs: ReadonlyArray): U[]; - ap(fns: Array<((a: T) => U)>): (vs: ReadonlyArray) => U[]; + ap(fns: Array<((a: T) => U)>, vs: T[]): U[]; + ap(fns: Array<((a: T) => U)>): (vs: T[]) => U[]; ap( fn: (x1: X1, x0: X0) => R, fn1: (x1: X1) => X0 @@ -881,21 +881,21 @@ declare namespace R { aperture(n: 8, list: T[]): Array<[T, T, T, T, T, T, T, T]>; aperture(n: 9, list: T[]): Array<[T, T, T, T, T, T, T, T, T]>; aperture(n: 10, list: T[]): Array<[T, T, T, T, T, T, T, T, T, T]>; - aperture(n: number, list: ReadonlyArray): T[][]; - aperture(n: number): (list: ReadonlyArray) => T[][]; + aperture(n: number, list: T[]): T[][]; + aperture(n: number): (list: T[]) => T[][]; /** * Returns a new list containing the contents of the given list, followed by the given element. */ - append(el: T, list: ReadonlyArray): T[]; - append(el: T): (list: ReadonlyArray) => T[]; + append(el: T, list: T[]): T[]; + append(el: T): (list: 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. */ - apply(fn: (arg0: T, ...args: T[]) => TResult, args: ReadonlyArray): TResult; - apply(fn: (arg0: T, ...args: T[]) => TResult): (args: ReadonlyArray) => TResult; + apply(fn: (arg0: T, ...args: T[]) => TResult, args: U[]): TResult; + apply(fn: (arg0: T, ...args: T[]) => TResult): (args: U[]) => TResult; /** * Given a spec object recursively mapping properties to functions, creates a function producing an object @@ -972,8 +972,8 @@ declare namespace R { * `chain` maps a function over a list and concatenates the results. * This implementation is compatible with the Fantasy-land Chain spec */ - chain(fn: (n: T) => ReadonlyArray, list: ReadonlyArray): U[]; - chain(fn: (n: T) => ReadonlyArray): (list: ReadonlyArray) => U[]; + chain(fn: (n: T) => U[], list: T[]): U[]; + chain(fn: (n: T) => U[]): (list: T[]) => U[]; chain(fn: (x0: X0, x1: X1) => R, fn1: (x1: X1) => X0): (x1: X1) => R; /** @@ -989,7 +989,7 @@ declare namespace R { * Creates a deep copy of the value which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates. */ clone(value: T): T; - clone(value: ReadonlyArray): T[]; + clone(value: T[]): T[]; /** * Makes a comparator function out of a function that reports whether the first element is less than the second. @@ -1141,10 +1141,10 @@ declare namespace R { * Returns a new list consisting of the elements of the first list followed by the elements * of the second. */ - concat(placeholder: Placeholder): (list2: ReadonlyArray, list1: ReadonlyArray) => T[]; - concat(placeholder: Placeholder, list2: ReadonlyArray): (list1: ReadonlyArray) => T[]; - concat(list1: ReadonlyArray, list2: ReadonlyArray): T[]; - concat(list1: ReadonlyArray): (list2: ReadonlyArray) => T[]; + concat(placeholder: Placeholder): (list2: T[], list1: T[]) => T[]; + concat(placeholder: Placeholder, list2: T[]): (list1: T[]) => T[]; + concat(list1: T[], list2: T[]): T[]; + concat(list1: T[]): (list2: T[]) => T[]; concat(list1: string, list2: string): string; concat(list1: string): (list2: string) => string; @@ -1154,8 +1154,8 @@ declare namespace R { * point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates * matches, fn returns undefined. */ - cond(fns: ReadonlyArray<[Pred, (...a: any[]) => any]>): (...a: any[]) => any; - cond(fns: ReadonlyArray<[SafePred, (...a: A[]) => B]>): (...a: A[]) => B; + cond(fns: Array<[Pred, (...a: any[]) => any]>): (...a: any[]) => any; + cond(fns: Array<[SafePred, (...a: A[]) => B]>): (...a: A[]) => B; /** * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type. @@ -1179,9 +1179,9 @@ declare namespace R { contains(__: Placeholder): (list: string, a: string) => boolean; contains(__: Placeholder): (list: T[], a: T) => boolean; contains(a: string, list: string): boolean; - contains(a: T, list: ReadonlyArray): boolean; + contains(a: T, list: T[]): boolean; contains(a: string): (list: string) => boolean; - contains(a: T): (list: ReadonlyArray) => boolean; + contains(a: T): (list: T[]) => boolean; /** * Accepts a converging function and a list of branching functions and returns a new @@ -1189,7 +1189,7 @@ declare namespace R { * 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. */ - converge(after: ((...a: any[]) => any), fns: ReadonlyArray<((...a: any[]) => any)>): (...a: any[]) => any; + converge(after: ((...a: any[]) => any), fns: Array<((...a: any[]) => any)>): (...a: any[]) => any; /** * Counts the elements of a list according to how many match each value @@ -1198,8 +1198,8 @@ declare namespace R { * the list. Note that all keys are coerced to strings because of how * JavaScript objects work. */ - countBy(fn: (a: T) => string | number, list: ReadonlyArray): { [index: string]: number }; - countBy(fn: (a: T) => string | number): (list: ReadonlyArray) => { [index: string]: number }; + countBy(fn: (a: T) => string | number, list: T[]): { [index: string]: number }; + countBy(fn: (a: T) => string | number): (list: T[]) => { [index: string]: number }; /** * Returns a curried equivalent of the provided function. The curried function has two unusual capabilities. @@ -1234,17 +1234,17 @@ declare namespace R { /** * Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list. */ - difference(list1: ReadonlyArray, list2: ReadonlyArray): T[]; - difference(list1: ReadonlyArray): (list2: ReadonlyArray) => T[]; + difference(list1: T[], list2: T[]): T[]; + difference(list1: T[]): (list2: 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. */ - differenceWith(pred: (a: T1, b: T2) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T1[]; - differenceWith(pred: (a: T1, b: T2) => boolean): (list1: ReadonlyArray, list2: ReadonlyArray) => T1[]; - differenceWith(pred: (a: T1, b: T2) => boolean, list1: ReadonlyArray): (list2: ReadonlyArray) => T1[]; + differenceWith(pred: (a: T1, b: T2) => boolean, list1: T1[], list2: T2[]): T1[]; + differenceWith(pred: (a: T1, b: T2) => boolean): (list1: T1[], list2: T2[]) => T1[]; + differenceWith(pred: (a: T1, b: T2) => boolean, list1: T1[]): (list2: T2[]) => T1[]; /* * Returns a new object that does not contain a prop property. @@ -1270,20 +1270,20 @@ declare namespace R { /** * Returns a new list containing all but the first n elements of the given list. */ - drop(n: number, xs: ReadonlyArray): T[]; + drop(n: number, xs: T[]): T[]; drop(n: number, xs: string): string; drop(n: number): { (xs: string): string; - (xs: ReadonlyArray): T[]; + (xs: T[]): T[]; }; /** * Returns a list containing all but the last n elements of the given list. */ - dropLast(n: number, xs: ReadonlyArray): T[]; + dropLast(n: number, xs: T[]): T[]; dropLast(n: number, xs: string): string; dropLast(n: number): { - (xs: ReadonlyArray): T[]; + (xs: T[]): T[]; (xs: string): string; }; @@ -1291,28 +1291,28 @@ declare namespace R { * 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. */ - dropLastWhile(fn: (a: T) => boolean, list: ReadonlyArray): T[]; - dropLastWhile(fn: (a: T) => boolean): (list: ReadonlyArray) => T[]; + dropLastWhile(fn: (a: T) => boolean, list: T[]): T[]; + dropLastWhile(fn: (a: T) => boolean): (list: T[]) => T[]; /** * Returns a new list without any consecutively repeating elements. R.equals is used to determine equality. */ - dropRepeats(list: ReadonlyArray): T[]; + dropRepeats(list: 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. */ - dropRepeatsWith(predicate: (left: T, right: T) => boolean, list: ReadonlyArray): T[]; - dropRepeatsWith(predicate: (left: T, right: T) => boolean): (list: ReadonlyArray) => T[]; + dropRepeatsWith(predicate: (left: T, right: T) => boolean, list: T[]): T[]; + dropRepeatsWith(predicate: (left: T, right: T) => boolean): (list: 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. */ - dropWhile(fn: (a: T) => boolean, list: ReadonlyArray): T[]; - dropWhile(fn: (a: T) => boolean): (list: ReadonlyArray) => T[]; + dropWhile(fn: (a: T) => boolean, list: T[]): T[]; + dropWhile(fn: (a: T) => boolean): (list: T[]) => T[]; /** * A function wrapping calls to the two functions in an || operation, returning the result of the first @@ -1334,8 +1334,8 @@ declare namespace R { */ endsWith(a: string, list: string): boolean; endsWith(a: string): (list: string) => boolean; - endsWith(a: T | ReadonlyArray, list: ReadonlyArray): boolean; - endsWith(a: T | ReadonlyArray): (list: ReadonlyArray) => boolean; + endsWith(a: T | T[], list: T[]): boolean; + endsWith(a: T | T[]): (list: T[]) => boolean; /** * Takes a function and two values in its domain and returns true if the values map to the same value in the @@ -1379,35 +1379,35 @@ declare namespace R { * Returns the first element of the list which matches the predicate, or `undefined` if no * element matches. */ - find(fn: (a: T) => boolean, list: ReadonlyArray): T | undefined; - find(fn: (a: T) => boolean): (list: ReadonlyArray) => T | undefined; + find(fn: (a: T) => boolean, list: T[]): T | undefined; + find(fn: (a: T) => boolean): (list: T[]) => T | undefined; /** * Returns the index of the first element of the list which matches the predicate, or `-1` * if no element matches. */ - findIndex(fn: (a: T) => boolean, list: ReadonlyArray): number; - findIndex(fn: (a: T) => boolean): (list: ReadonlyArray) => number; + findIndex(fn: (a: T) => boolean, list: T[]): number; + findIndex(fn: (a: T) => boolean): (list: T[]) => number; /** * Returns the last element of the list which matches the predicate, or `undefined` if no * element matches. */ - findLast(fn: (a: T) => boolean, list: ReadonlyArray): T | undefined; - findLast(fn: (a: T) => boolean): (list: ReadonlyArray) => T | undefined; + findLast(fn: (a: T) => boolean, list: T[]): T | undefined; + findLast(fn: (a: T) => boolean): (list: T[]) => T | undefined; /** * Returns the index of the last element of the list which matches the predicate, or * `-1` if no element matches. */ - findLastIndex(fn: (a: T) => boolean, list: ReadonlyArray): number; - findLastIndex(fn: (a: T) => boolean): (list: ReadonlyArray) => number; + findLastIndex(fn: (a: T) => boolean, list: T[]): number; + findLastIndex(fn: (a: T) => boolean): (list: 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. */ - flatten(x: ReadonlyArray | ReadonlyArray> | ReadonlyArray): T[]; + flatten(x: T[][] | T[][] | T[]): T[]; /** * Returns a new function much like the supplied one, except that the first two arguments' @@ -1421,8 +1421,8 @@ declare namespace R { */ forEach(fn: (x: T) => void, list: T[]): T[]; forEach(fn: (x: T) => void): (list: T[]) => T[]; - forEach(fn: (x: T) => void, list: ReadonlyArray): ReadonlyArray; - forEach(fn: (x: T) => void): (list: ReadonlyArray) => ReadonlyArray; + forEach(fn: (x: T) => void, list: T[]): T[]; + forEach(fn: (x: T) => void): (list: T[]) => T[]; /** * Iterate over an input object, calling a provided function fn for each key and value in the object. @@ -1441,14 +1441,14 @@ declare namespace R { * calling a String-returning function * on each element, and grouping the results according to values returned. */ - groupBy(fn: (a: T) => string, list: ReadonlyArray): { [index: string]: T[] }; - groupBy(fn: (a: T) => string): (list: ReadonlyArray) => { [index: string]: T[] }; + groupBy(fn: (a: T) => string, list: T[]): { [index: string]: T[] }; + groupBy(fn: (a: T) => string): (list: T[]) => { [index: string]: T[] }; /** * Takes a list and returns a list of lists where each sublist's elements are all "equal" according to the provided equality function */ - groupWith(fn: (x: T, y: T) => boolean): (list: ReadonlyArray) => T[][]; - groupWith(fn: (x: T, y: T) => boolean, list: ReadonlyArray): T[][]; + groupWith(fn: (x: T, y: T) => boolean): (list: T[]) => T[][]; + groupWith(fn: (x: T, y: T) => boolean, list: T[]): T[][]; groupWith(fn: (x: T, y: T) => boolean, list: string): string[]; /** @@ -1484,8 +1484,8 @@ declare namespace R { /** * Returns whether or not a path exists in an object. Only the object's own properties are checked. */ - hasPath(list: ReadonlyArray, obj: T): boolean; - hasPath(list: ReadonlyArray): (obj: T) => boolean; + hasPath(list: string[], obj: T): boolean; + hasPath(list: string[]): (obj: T) => boolean; /** * Returns the first element in a list. @@ -1493,7 +1493,7 @@ declare namespace R { */ head(str: string): string; head(list: []): undefined; - head(list: ReadonlyArray): T; + head(list: T[]): T; /** * Returns true if its arguments are identical, false otherwise. Values are identical if they reference the @@ -1525,30 +1525,30 @@ declare namespace R { * Given a string, this function checks for the string in another string or list and returns * a boolean. */ - includes(s: string, list: ReadonlyArray | string): boolean; - includes(s: string): (list: ReadonlyArray | string) => boolean; - includes(target: T, list: ReadonlyArray): boolean; - includes(target: T): (list: ReadonlyArray) => boolean; + includes(s: string, list: string[] | string): boolean; + includes(s: string): (list: string[] | string) => boolean; + includes(target: T, list: T[]): boolean; + includes(target: T): (list: T[]) => boolean; /** * Given a function that generates a key, turns a list of objects into an object indexing the objects * by the given key. */ - indexBy(fn: (a: T) => string, list: ReadonlyArray): { [key: string]: T }; - indexBy(fn: (a: T) => string): (list: ReadonlyArray) => { [key: string]: T }; + indexBy(fn: (a: T) => string, list: T[]): { [key: string]: T }; + indexBy(fn: (a: T) => string): (list: T[]) => { [key: string]: 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. */ - indexOf(target: T, list: ReadonlyArray): number; - indexOf(target: T): (list: ReadonlyArray) => number; + indexOf(target: T, list: T[]): number; + indexOf(target: T): (list: T[]) => number; /** * Returns all but the last element of a list or string. */ - init(list: ReadonlyArray): T[]; + init(list: T[]): T[]; init(list: string): string; /** @@ -1564,31 +1564,31 @@ declare namespace R { * not removed, so `xs'` may contain duplicates if `xs` contains duplicates. */ - innerJoin(pred: (a: T1, b: T2) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T1[]; - innerJoin(pred: (a: T1, b: T2) => boolean): (list1: ReadonlyArray, list2: ReadonlyArray) => T1[]; - innerJoin(pred: (a: T1, b: T2) => boolean, list1: ReadonlyArray): (list2: ReadonlyArray) => T1[]; + innerJoin(pred: (a: T1, b: T2) => boolean, list1: T1[], list2: T2[]): T1[]; + innerJoin(pred: (a: T1, b: T2) => boolean): (list1: T1[], list2: T2[]) => T1[]; + innerJoin(pred: (a: T1, b: T2) => boolean, list1: T1[]): (list2: 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. */ - insert(index: number, elt: T, list: ReadonlyArray): T[]; - insert(index: number, elt: T): (list: ReadonlyArray) => T[]; - insert(index: number): (elt: T, list: ReadonlyArray) => T[]; + insert(index: number, elt: T, list: T[]): T[]; + insert(index: number, elt: T): (list: T[]) => T[]; + insert(index: number): (elt: T, list: 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. */ - insertAll(index: number, elts: ReadonlyArray, list: ReadonlyArray): T[]; - insertAll(index: number, elts: ReadonlyArray): (list: ReadonlyArray) => T[]; - insertAll(index: number): (elts: ReadonlyArray, list: ReadonlyArray) => T[]; + insertAll(index: number, elts: T[], list: T[]): T[]; + insertAll(index: number, elts: T[]): (list: T[]) => T[]; + insertAll(index: number): (elts: T[], list: T[]) => T[]; /** * Combines two lists into a set (i.e. no duplicates) composed of those elements common to both lists. */ - intersection(list1: ReadonlyArray, list2: ReadonlyArray): T[]; - intersection(list1: ReadonlyArray): (list2: ReadonlyArray) => T[]; + intersection(list1: T[], list2: T[]): T[]; + intersection(list1: T[]): (list2: T[]) => T[]; /** * Combines two lists into a set (i.e. no duplicates) composed of those @@ -1596,21 +1596,21 @@ declare namespace R { * to the value returned by applying the supplied predicate to two list * elements. */ - intersectionWith(pred: (a: T, b: T) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T[]; + intersectionWith(pred: (a: T, b: T) => boolean, list1: T[], list2: T[]): T[]; /** * Creates a new list with the separator interposed between elements. */ - intersperse(separator: T, list: ReadonlyArray): T[]; - intersperse(separator: T): (list: ReadonlyArray) => T[]; + intersperse(separator: T, list: T[]): T[]; + intersperse(separator: T): (list: 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. */ - into(acc: any, xf: (...a: any[]) => any, list: ReadonlyArray): T[]; - into(acc: any, xf: (...a: any[]) => any): (list: ReadonlyArray) => T[]; - into(acc: any): (xf: (...a: any[]) => any, list: ReadonlyArray) => T[]; + into(acc: any, xf: (...a: any[]) => any, list: T[]): T[]; + into(acc: any, xf: (...a: any[]) => any): (list: T[]) => T[]; + into(acc: any): (xf: (...a: any[]) => any, list: T[]) => T[]; /** * Same as R.invertObj, however this accounts for objects with duplicate values by putting the values into an array. @@ -1662,8 +1662,8 @@ declare namespace R { * Returns a string made by inserting the `separator` between each * element and concatenating all the elements into a single string. */ - join(x: string, xs: ReadonlyArray): string; - join(x: string): (xs: ReadonlyArray) => string; + join(x: string, xs: any[]): string; + join(x: string): (xs: any[]) => string; /** * Applies a list of functions to a list of values. @@ -1678,7 +1678,7 @@ declare namespace R { * Returns a list containing the names of all the enumerable own * properties of the supplied object. */ - keys(x: T): Array; + keys(x: T): keyof T[]; keys(x: T): string[]; /** @@ -1692,18 +1692,18 @@ declare namespace R { */ last(str: string): string; last(list: []): undefined; - last(list: ReadonlyArray): T; + last(list: T[]): T; /** * 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. */ - lastIndexOf(target: T, list: ReadonlyArray): number; + lastIndexOf(target: T, list: T[]): number; /** * Returns the number of elements in the array by returning list.length. */ - length(list: ReadonlyArray): number; + length(list: T[]): number; /** * Returns a lens for the given getter and setter functions. The getter @@ -1763,8 +1763,8 @@ declare namespace R { /** * Returns a new list, constructed by applying the supplied function to every element of the supplied list. */ - map(fn: (x: T) => U, list: ReadonlyArray): U[]; - map(fn: (x: T) => U): (list: ReadonlyArray) => U[]; + map(fn: (x: T) => U, list: T[]): U[]; + map(fn: (x: T) => U): (list: T[]) => U[]; map(fn: (x: T[keyof T & keyof U]) => U[keyof T & keyof U], list: T): U; map(fn: (x: T[keyof T & keyof U]) => U[keyof T & keyof U]): (list: T) => U; map(fn: (x: T) => U, obj: Functor): Functor; // used in functors @@ -1773,16 +1773,16 @@ declare namespace R { /** * The mapAccum function behaves like a combination of map and reduce. */ - mapAccum(fn: (acc: U, value: T) => [U, TResult], acc: U, list: ReadonlyArray): [U, TResult[]]; - mapAccum(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: ReadonlyArray) => [U, TResult[]]; - mapAccum(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: ReadonlyArray) => [U, TResult[]]; + mapAccum(fn: (acc: U, value: T) => [U, TResult], acc: U, list: T[]): [U, TResult[]]; + mapAccum(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: T[]) => [U, TResult[]]; + mapAccum(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: T[]) => [U, TResult[]]; /** * The mapAccumRight function behaves like a combination of map and reduce. */ - mapAccumRight(fn: (acc: U, value: T) => [U, TResult], acc: U, list: ReadonlyArray): [U, TResult[]]; - mapAccumRight(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: ReadonlyArray) => [U, TResult[]]; - mapAccumRight(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: ReadonlyArray) => [U, TResult[]]; + mapAccumRight(fn: (acc: U, value: T) => [U, TResult], acc: U, list: T[]): [U, TResult[]]; + mapAccumRight(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: T[]) => [U, TResult[]]; + mapAccumRight(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: T[]) => [U, TResult[]]; /** * Like mapObj, but but passes additional arguments to the predicate function. @@ -1834,12 +1834,12 @@ declare namespace R { /** * Returns the mean of the given list of numbers. */ - mean(list: ReadonlyArray): number; + mean(list: number[]): number; /** * Returns the median of the given list of numbers. */ - median(list: ReadonlyArray): number; + median(list: number[]): number; /** * Creates a new function that, when invoked, caches the result of calling fn for a given argument set and returns the result. @@ -1862,8 +1862,8 @@ declare namespace R { /** * Merges a list of objects together into one object. */ - mergeAll(list: ReadonlyArray): T; - mergeAll(list: ReadonlyArray): any; + mergeAll(list: T[]): T; + mergeAll(list: any[]): any; /** * Creates a new object with the own properties of the first object merged with the own properties of the second object. @@ -1973,11 +1973,11 @@ declare namespace R { * Moves an item, at index `from`, to index `to`, in a `list` of elements. * A new list will be created containing the new elements order. */ - move(from: number, to: number, list: ReadonlyArray): T[]; - move(from: number, to: number): (list: ReadonlyArray) => T[]; + move(from: number, to: number, list: T[]): T[]; + move(from: number, to: number): (list: T[]) => T[]; move(from: number): { - (to: number, list: ReadonlyArray): T[]; - (to: number): (list: ReadonlyArray) => T[]; + (to: number, list: T[]): T[]; + (to: number): (list: T[]) => T[]; }; /** @@ -1995,8 +1995,8 @@ declare namespace R { /** * Returns true if no elements of the list match the predicate, false otherwise. */ - none(fn: (a: T) => boolean, list: ReadonlyArray): boolean; - none(fn: (a: T) => boolean): (list: ReadonlyArray) => boolean; + none(fn: (a: T) => boolean, list: T[]): boolean; + none(fn: (a: T) => boolean): (list: T[]) => boolean; /** * A function wrapping a call to the given function in a `!` operation. It will return `true` when the @@ -2007,8 +2007,8 @@ declare namespace R { /** * Returns the nth element in a list. */ - nth(n: number, list: ReadonlyArray): T | undefined; - nth(n: number): (list: ReadonlyArray) => T | undefined; + nth(n: number, list: T[]): T | undefined; + nth(n: number): (list: T[]) => T | undefined; /** * Returns a function which returns its nth argument. @@ -2029,8 +2029,8 @@ declare namespace R { /** * Returns a partial copy of an object omitting the keys specified. */ - omit(names: ReadonlyArray, obj: T): Omit; - omit(names: ReadonlyArray): (obj: T) => Omit; + omit(names: K[], obj: T): Omit; + omit(names: K[]): (obj: T) => Omit; /** * Accepts a function fn and returns a function that guards invocation of fn such that fn can only ever be @@ -2109,10 +2109,10 @@ declare namespace R { * Takes a predicate and a list and returns the pair of lists of elements * which do and do not satisfy the predicate, respectively. */ - partition(fn: (a: string) => boolean, list: ReadonlyArray): [string[], string[]]; - partition(fn: (a: T) => boolean, list: ReadonlyArray): [T[], T[]]; - partition(fn: (a: T) => boolean): (list: ReadonlyArray) => [T[], T[]]; - partition(fn: (a: string) => boolean): (list: ReadonlyArray) => [string[], string[]]; + partition(fn: (a: string) => boolean, list: string[]): [string[], string[]]; + partition(fn: (a: T) => boolean, list: T[]): [T[], T[]]; + partition(fn: (a: T) => boolean): (list: T[]) => [T[], T[]]; + partition(fn: (a: string) => boolean): (list: string[]) => [string[], string[]]; /** * Retrieve the value at a given path. @@ -2147,14 +2147,14 @@ declare namespace R { * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the * property is ignored. */ - pick(names: ReadonlyArray, obj: T): Pick>>; - pick(names: ReadonlyArray): (obj: T) => Pick>>; + pick(names: K[], obj: T): Pick>>; + pick(names: K[]): (obj: T) => Pick>>; /** * Similar to `pick` except that this one includes a `key: undefined` pair for properties that don't exist. */ - pickAll(names: ReadonlyArray, obj: T): U; - pickAll(names: ReadonlyArray): (obj: T) => U; + pickAll(names: string[], obj: T): U; + pickAll(names: string[]): (obj: T) => U; /** * Returns a partial copy of an object containing only the keys that satisfy the supplied predicate. @@ -2515,28 +2515,28 @@ declare namespace R { /** * Returns a new list by plucking the same named property off all objects in the list supplied. */ - pluck(p: K, list: ReadonlyArray): Array; - pluck(p: number, list: ReadonlyArray<{ [k: number]: T }>): T[]; - pluck

(p: P): (list: ReadonlyArray>) => T[]; - pluck(p: number): (list: ReadonlyArray<{ [k: number]: T }>) => T[]; + pluck(p: K, list: T[]): Array; + pluck(p: number, list: Array<{ [k: number]: T }>): T[]; + pluck

(p: P): (list: Array>) => T[]; + pluck(p: number): (list: Array<{ [k: number]: T }>) => T[]; /** * Returns a new list with the given element at the front, followed by the contents of the * list. */ - prepend(el: T, list: ReadonlyArray): T[]; - prepend(el: T): (list: ReadonlyArray) => T[]; + prepend(el: T, list: T[]): T[]; + prepend(el: T): (list: T[]) => T[]; /** * Multiplies together all the elements of a list. */ - product(list: ReadonlyArray): number; + product(list: number[]): number; /** * Reasonable analog to SQL `select` statement. */ - project(props: ReadonlyArray, objs: ReadonlyArray): U[]; - project(props: ReadonlyArray): (objs: ReadonlyArray) => U[]; + project(props: string[], objs: T[]): U[]; + project(props: string[]): (objs: T[]) => U[]; /** * Returns a function that when supplied an object returns the indicated property of that object, if it exists. @@ -2583,9 +2583,9 @@ declare namespace R { * The only difference from `prop` is the parameter order. * Note: TS1.9 # replace any by dictionary */ - props

(ps: ReadonlyArray

, obj: Record): T[]; - props

(ps: ReadonlyArray

): (obj: Record) => T[]; - props

(ps: ReadonlyArray

): (obj: Record) => T[]; + props

(ps: P[], obj: Record): T[]; + props

(ps: P[]): (obj: Record) => T[]; + props

(ps: P[]): (obj: Record) => T[]; /** * Returns true if the specified object property satisfies the given predicate; false otherwise. @@ -2607,18 +2607,18 @@ declare namespace R { * function and passing it an accumulator value and the current value from the array, and * then passing the result to the next call. */ - reduce(fn: (acc: TResult, elem: T) => TResult | Reduced, acc: TResult, list: ReadonlyArray): TResult; - reduce(fn: (acc: TResult, elem: T) => TResult | Reduced): (acc: TResult, list: ReadonlyArray) => TResult; - reduce(fn: (acc: TResult, elem: T) => TResult | Reduced, acc: TResult): (list: ReadonlyArray) => TResult; + reduce(fn: (acc: TResult, elem: T) => TResult | Reduced, acc: TResult, list: T[]): TResult; + reduce(fn: (acc: TResult, elem: T) => TResult | Reduced): (acc: TResult, list: T[]) => TResult; + reduce(fn: (acc: TResult, elem: T) => TResult | Reduced, acc: TResult): (list: T[]) => TResult; /** * Groups the elements of the list according to the result of calling the String-returning function keyFn on each * element and reduces the elements of each group to a single value via the reducer function valueFn. */ - reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string, list: ReadonlyArray): { [index: string]: TResult }; - reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string): (list: ReadonlyArray) => { [index: string]: TResult }; - reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): F.Curry<(a: (elem: T) => string, b: ReadonlyArray) => { [index: string]: TResult }>; - reduceBy(valueFn: (acc: TResult, elem: T) => TResult): F.Curry<(a: TResult, b: (elem: T) => string, c: ReadonlyArray) => { [index: string]: TResult }>; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string, list: T[]): { [index: string]: TResult }; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string): (list: T[]) => { [index: string]: TResult }; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): F.Curry<(a: (elem: T) => string, b: T[]) => { [index: string]: TResult }>; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult): F.Curry<(a: TResult, b: (elem: T) => string, c: T[]) => { [index: string]: TResult }>; /** * Returns a value wrapped to indicate that it is the final value of the reduce and @@ -2632,9 +2632,9 @@ declare namespace R { * function and passing it an accumulator value and the current value from the array, and * then passing the result to the next call. */ - reduceRight(fn: (elem: T, acc: TResult) => TResult, acc: TResult, list: ReadonlyArray): TResult; - reduceRight(fn: (elem: T, acc: TResult) => TResult): (acc: TResult, list: ReadonlyArray) => TResult; - reduceRight(fn: (elem: T, acc: TResult) => TResult, acc: TResult): (list: ReadonlyArray) => TResult; + reduceRight(fn: (elem: T, acc: TResult) => TResult, acc: TResult, list: T[]): TResult; + reduceRight(fn: (elem: T, acc: TResult) => TResult): (acc: TResult, list: T[]) => TResult; + reduceRight(fn: (elem: T, acc: TResult) => TResult, acc: TResult): (list: T[]) => TResult; /** * Like reduce, reduceWhile returns a single item by iterating through the list, successively @@ -2642,10 +2642,10 @@ declare namespace R { * each step. If the predicate returns false, it "short-circuits" the iteration and returns * the current value of the accumulator. */ - reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: ReadonlyArray): TResult; - reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: ReadonlyArray) => TResult; - reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): F.Curry<(a: TResult, b: ReadonlyArray) => TResult>; - reduceWhile(predicate: (acc: TResult, elem: T) => boolean): F.Curry<(a: (acc: TResult, elem: T) => TResult, b: TResult, c: ReadonlyArray) => TResult>; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: T[]): TResult; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: T[]) => TResult; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): F.Curry<(a: TResult, b: T[]) => TResult>; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean): F.Curry<(a: (acc: TResult, elem: T) => TResult, b: TResult, c: T[]) => TResult>; /** * Similar to `filter`, except that it keeps only values for which the given predicate @@ -2656,9 +2656,9 @@ declare namespace R { /** * Removes the sub-list of `list` starting at index `start` and containing `count` elements. */ - remove(start: number, count: number, list: ReadonlyArray): T[]; - remove(start: number): (count: number, list: ReadonlyArray) => T[]; - remove(start: number, count: number): (list: ReadonlyArray) => T[]; + remove(start: number, count: number, list: T[]): T[]; + remove(start: number): (count: number, list: T[]) => T[]; + remove(start: number, count: number): (list: T[]) => T[]; /** * Returns a fixed list of size n containing a specified identical value. @@ -2676,7 +2676,7 @@ declare namespace R { /** * Returns a new list with the same elements as the original list, just in the reverse order. */ - reverse(list: ReadonlyArray): T[]; + reverse(list: T[]): T[]; /** * Returns a new string with the characters in reverse order. */ @@ -2685,9 +2685,9 @@ declare namespace R { /** * Scan is similar to reduce, but returns a list of successively reduced values from the left. */ - scan(fn: (acc: TResult, elem: T) => any, acc: TResult, list: ReadonlyArray): TResult[]; - scan(fn: (acc: TResult, elem: T) => any, acc: TResult): (list: ReadonlyArray) => TResult[]; - scan(fn: (acc: TResult, elem: T) => any): (acc: TResult, list: ReadonlyArray) => TResult[]; + scan(fn: (acc: TResult, elem: T) => any, acc: TResult, list: T[]): TResult[]; + scan(fn: (acc: TResult, elem: T) => any, acc: TResult): (list: T[]) => TResult[]; + scan(fn: (acc: TResult, elem: T) => any): (acc: TResult, list: T[]) => TResult[]; /** * Returns the result of "setting" the portion of the given data structure focused by the given lens to the @@ -2701,14 +2701,14 @@ declare namespace R { * Returns the elements from `xs` starting at `a` and ending at `b - 1`. */ slice(a: number, b: number, list: string): string; - slice(a: number, b: number, list: ReadonlyArray): T[]; + slice(a: number, b: number, list: T[]): T[]; slice(a: number, b: number): { (list: string): string; - (list: ReadonlyArray): T[]; + (list: T[]): T[]; }; slice(a: number): { (b: number, list: string): string; - (b: number, list: ReadonlyArray): T[]; + (b: number, list: T[]): T[]; }; /** @@ -2716,20 +2716,20 @@ declare namespace R { * time and return a negative number if the first value is smaller, a positive number if it's larger, and zero * if they are equal. */ - sort(fn: (a: T, b: T) => number, list: ReadonlyArray): T[]; - sort(fn: (a: T, b: T) => number): (list: ReadonlyArray) => T[]; + sort(fn: (a: T, b: T) => number, list: T[]): T[]; + sort(fn: (a: T, b: T) => number): (list: T[]) => T[]; /** * Sorts the list according to a key generated by the supplied function. */ - sortBy(fn: (a: T) => Ord, list: ReadonlyArray): T[]; - sortBy(fn: (a: any) => Ord): (list: ReadonlyArray) => T[]; + sortBy(fn: (a: T) => Ord, list: T[]): T[]; + sortBy(fn: (a: any) => Ord): (list: T[]) => T[]; /** * Sorts a list according to a list of comparators. */ - sortWith(fns: ReadonlyArray<((a: T, b: T) => number)>, list: ReadonlyArray): T[]; - sortWith(fns: ReadonlyArray<((a: T, b: T) => number)>): (list: ReadonlyArray) => T[]; + sortWith(fns: Array<((a: T, b: T) => number)>, list: T[]): T[]; + sortWith(fns: Array<((a: T, b: T) => number)>): (list: T[]) => T[]; /** * Splits a string into an array of strings based on the given @@ -2741,21 +2741,21 @@ declare namespace R { /** * Splits a given list or string at a given index. */ - splitAt(index: number, list: ReadonlyArray): [T[], T[]]; + splitAt(index: number, list: T[]): [T[], T[]]; splitAt(index: number, list: string): [string, string]; splitAt(index: number): { - (list: ReadonlyArray): [T[], T[]]; + (list: T[]): [T[], T[]]; (list: string): [string, string]; }; /** * Splits a collection into slices of the specified length. */ - splitEvery(a: number, list: ReadonlyArray): T[][]; + splitEvery(a: number, list: T[]): T[][]; splitEvery(a: number, list: string): string[]; splitEvery(a: number): { (list: string): string[]; - (list: ReadonlyArray): T[][]; + (list: T[]): T[][]; }; /** @@ -2764,16 +2764,16 @@ declare namespace R { * - none of the elements of the first output list satisfies the predicate; and * - if the second output list is non-empty, its first element satisfies the predicate. */ - splitWhen(pred: (val: T) => boolean, list: ReadonlyArray): U[][]; - splitWhen(pred: (val: T) => boolean): (list: ReadonlyArray) => U[][]; + splitWhen(pred: (val: T) => boolean, list: U[]): U[][]; + splitWhen(pred: (val: T) => boolean): (list: U[]) => U[][]; /** * Checks if a list starts with the provided values */ startsWith(a: string, list: string): boolean; startsWith(a: string): (list: string) => boolean; - startsWith(a: T | ReadonlyArray, list: ReadonlyArray): boolean; - startsWith(a: T | ReadonlyArray): (list: ReadonlyArray) => boolean; + startsWith(a: T | T[], list: T[]): boolean; + startsWith(a: T | T[]): (list: T[]) => boolean; /** * Subtracts two numbers. Equivalent to `a - b` but curried. @@ -2786,20 +2786,20 @@ declare namespace R { /** * Adds together all the elements of a list. */ - sum(list: ReadonlyArray): number; + sum(list: number[]): number; /** * Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both. */ - symmetricDifference(list1: ReadonlyArray, list2: ReadonlyArray): T[]; - symmetricDifference(list: ReadonlyArray): (list: ReadonlyArray) => T[]; + symmetricDifference(list1: T[], list2: T[]): T[]; + symmetricDifference(list: T[]): (list: T[]) => T[]; /** * Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both. * Duplication is determined according to the value returned by applying the supplied predicate to two list elements. */ - symmetricDifferenceWith(pred: (a: T, b: T) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T[]; - symmetricDifferenceWith(pred: (a: T, b: T) => boolean): F.Curry<(a: ReadonlyArray, b: ReadonlyArray) => T[]>; + symmetricDifferenceWith(pred: (a: T, b: T) => boolean, list1: T[], list2: T[]): T[]; + symmetricDifferenceWith(pred: (a: T, b: T) => boolean): F.Curry<(a: T[], b: T[]) => T[]>; /** * A function that always returns true. Any passed in parameters are ignored. @@ -2810,27 +2810,27 @@ declare namespace R { * Returns all but the first element of a list or string. */ tail(list: string): string; - tail(list: ReadonlyArray): T[]; + tail(list: T[]): T[]; /** * Returns a new list containing the first `n` elements of the given list. If * `n > * list.length`, returns a list of `list.length` elements. */ - take(n: number, xs: ReadonlyArray): T[]; + take(n: number, xs: T[]): T[]; take(n: number, xs: string): string; take(n: number): { (xs: string): string; - (xs: ReadonlyArray): T[]; + (xs: T[]): T[]; }; /** * Returns a new list containing the last n elements of the given list. If n > list.length, * returns a list of list.length elements. */ - takeLast(n: number, xs: ReadonlyArray): T[]; + takeLast(n: number, xs: T[]): T[]; takeLast(n: number, xs: string): string; takeLast(n: number): { - (xs: ReadonlyArray): T[]; + (xs: T[]): T[]; (xs: string): string; }; @@ -2840,16 +2840,16 @@ declare namespace R { * false. Excludes the element that caused the predicate function to fail. The predicate * function is passed one argument: (value). */ - takeLastWhile(pred: (a: T) => boolean, list: ReadonlyArray): T[]; - takeLastWhile(pred: (a: T) => boolean): (list: ReadonlyArray) => T[]; + takeLastWhile(pred: (a: T) => boolean, list: T[]): T[]; + takeLastWhile(pred: (a: T) => boolean): (list: T[]) => T[]; /** * Returns a new list containing the first `n` elements of a given list, passing each value * to the supplied predicate function, and terminating when the predicate function returns * `false`. */ - takeWhile(fn: (x: T) => boolean, list: ReadonlyArray): T[]; - takeWhile(fn: (x: T) => boolean): (list: ReadonlyArray) => T[]; + takeWhile(fn: (x: T) => boolean, list: T[]): T[]; + takeWhile(fn: (x: T) => boolean): (list: T[]) => T[]; /** * The function to call with x. The return value of fn will be thrown away. @@ -2925,24 +2925,24 @@ declare namespace R { * list, successively calling the transformed iterator function and passing it an accumulator value and the * current value from the array, and then passing the result to the next call. */ - transduce(xf: (arg: T[]) => ReadonlyArray, fn: (acc: U[], val: U) => ReadonlyArray, acc: ReadonlyArray, list: ReadonlyArray): U; - transduce(xf: (arg: T[]) => ReadonlyArray): (fn: (acc: U[], val: U) => ReadonlyArray, acc: ReadonlyArray, list: ReadonlyArray) => U; - transduce(xf: (arg: T[]) => ReadonlyArray, fn: (acc: U[], val: U) => ReadonlyArray): (acc: ReadonlyArray, list: ReadonlyArray) => U; - transduce(xf: (arg: T[]) => ReadonlyArray, fn: (acc: U[], val: U) => ReadonlyArray, acc: ReadonlyArray): (list: ReadonlyArray) => U; + transduce(xf: (arg: T[]) => T[], fn: (acc: U[], val: U) => U[], acc: T[], list: T[]): U; + transduce(xf: (arg: T[]) => T[]): (fn: (acc: U[], val: U) => U[], acc: T[], list: T[]) => U; + transduce(xf: (arg: T[]) => T[], fn: (acc: U[], val: U) => U[]): (acc: T[], list: T[]) => U; + transduce(xf: (arg: T[]) => T[], fn: (acc: U[], val: U) => U[], acc: T[]): (list: T[]) => U; /** * Transposes the rows and columns of a 2D list. When passed a list of n lists of length x, returns a list of x lists of length n. */ - transpose(list: ReadonlyArray): T[][]; + transpose(list: T[][]): T[][]; /** * Maps an Applicative-returning function over a Traversable, then uses * sequence to transform the resulting Traversable of Applicative into * an Applicative of Traversable. */ - traverse(of: (a: B) => ReadonlyArray, fn: (t: A) => ReadonlyArray, list: ReadonlyArray): B[][]; - traverse(of: (a: B) => ReadonlyArray, fn: (t: A) => ReadonlyArray): (list: ReadonlyArray) => B[][]; - traverse(of: (a: B) => ReadonlyArray): (fn: (t: A) => ReadonlyArray, list: ReadonlyArray) => B[][]; + traverse(of: (a: B) => B[], fn: (t: A) => B[], list: A[]): B[][]; + traverse(of: (a: B) => B[], fn: (t: A) => B[]): (list: A[]) => B[][]; + traverse(of: (a: B) => B[]): (fn: (t: A) => B[], list: A[]) => B[][]; /** * Removes (strips) whitespace from both ends of the string. @@ -2997,20 +2997,20 @@ declare namespace R { * Combines two lists into a set (i.e. no duplicates) composed of the * elements of each list. */ - union(as: ReadonlyArray, bs: ReadonlyArray): T[]; - union(as: ReadonlyArray): (bs: ReadonlyArray) => T[]; + union(as: T[], bs: T[]): T[]; + union(as: T[]): (bs: T[]) => T[]; /** * Combines two lists into a set (i.e. no duplicates) composed of the elements of each list. Duplication is * determined according to the value returned by applying the supplied predicate to two list elements. */ - unionWith(pred: (a: T, b: T) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T[]; - unionWith(pred: (a: T, b: T) => boolean): F.Curry<(a: ReadonlyArray, b: ReadonlyArray) => T[]>; + unionWith(pred: (a: T, b: T) => boolean, list1: T[], list2: T[]): T[]; + unionWith(pred: (a: T, b: T) => boolean): F.Curry<(a: T[], b: T[]) => T[]>; /** * Returns a new list containing only one copy of each element in the original list. */ - uniq(list: ReadonlyArray): T[]; + uniq(list: T[]): T[]; /** * Returns a new list containing only one copy of each element in the original list, @@ -3018,15 +3018,15 @@ declare namespace R { * Prefers the first item if the supplied function produces the same value on two items. * R.equals is used for comparison. */ - uniqBy(fn: (a: T) => U, list: ReadonlyArray): T[]; - uniqBy(fn: (a: T) => U): (list: ReadonlyArray) => T[]; + uniqBy(fn: (a: T) => U, list: T[]): T[]; + uniqBy(fn: (a: T) => U): (list: T[]) => T[]; /** * Returns a new list containing only one copy of each element in the original list, based upon the value * returned by applying the supplied predicate to two list elements. */ - uniqWith(pred: (x: T, y: T) => boolean, list: ReadonlyArray): T[]; - uniqWith(pred: (x: T, y: T) => boolean): (list: ReadonlyArray) => T[]; + uniqWith(pred: (x: T, y: T) => boolean, list: T[]): T[]; + uniqWith(pred: (x: T, y: T) => boolean): (list: T[]) => T[]; /** * Tests the final argument by passing it to the given predicate function. If the predicate is not satisfied, @@ -3040,7 +3040,7 @@ declare namespace R { * Returns a new list by pulling every item at the first level of nesting out, and putting * them in a new array. */ - unnest(x: ReadonlyArray | ReadonlyArray> | ReadonlyArray): T[]; + unnest(x: T[][] | T[]): T[]; /** * Takes a predicate, a transformation function, and an initial value, and returns a value of the same type as @@ -3053,8 +3053,8 @@ declare namespace R { /** * Returns a new copy of the array with the element at the provided index replaced with the given value. */ - update(index: number, value: T, list: ReadonlyArray): T[]; - update(index: number, value: T): (list: ReadonlyArray) => T[]; + update(index: number, value: T, list: T[]): T[]; + update(index: number, value: T): (list: T[]) => T[]; /** * Accepts a function fn and a list of transformer functions and returns a new curried function. @@ -3125,8 +3125,8 @@ declare namespace R { * Returns a new list without values in the first argument. R.equals is used to determine equality. * Acts as a transducer if a transformer is given in list position. */ - without(list1: ReadonlyArray, list2: ReadonlyArray): T[]; - without(list1: ReadonlyArray): (list2: ReadonlyArray) => T[]; + without(list1: T[], list2: T[]): T[]; + without(list1: T[]): (list2: T[]) => T[]; /** * Wrap a function inside another to allow you to make adjustments to the parameters, or do other processing @@ -3137,32 +3137,32 @@ declare namespace R { /** * Creates a new list out of the two supplied by creating each possible pair from the lists. */ - xprod(as: ReadonlyArray, bs: ReadonlyArray): Array>; - xprod(as: ReadonlyArray): (bs: ReadonlyArray) => Array>; + xprod(as: K[], bs: V[]): Array>; + xprod(as: K[]): (bs: V[]) => Array>; /** * Creates a new list out of the two supplied by pairing up equally-positioned items from * both lists. Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`. */ - zip(list1: ReadonlyArray, list2: ReadonlyArray): Array>; - zip(list1: ReadonlyArray): (list2: ReadonlyArray) => Array>; + zip(list1: K[], list2: V[]): Array>; + zip(list1: K[]): (list2: V[]) => Array>; /** * Creates a new object out of a list of keys and a list of values. */ // TODO: Dictionary as a return value is to specific, any seems to loose - zipObj(keys: ReadonlyArray, values: ReadonlyArray): { [index: string]: T }; - zipObj(keys: ReadonlyArray): (values: ReadonlyArray) => { [index: string]: T }; - zipObj(keys: ReadonlyArray, values: ReadonlyArray): { [index: number]: T }; - zipObj(keys: ReadonlyArray): (values: ReadonlyArray) => { [index: number]: T }; + zipObj(keys: string[], values: T[]): { [index: string]: T }; + zipObj(keys: string[]): (values: T[]) => { [index: string]: T }; + zipObj(keys: number[], values: T[]): { [index: number]: T }; + zipObj(keys: number[]): (values: T[]) => { [index: number]: T }; /** * Creates a new list out of the two supplied by applying the function to each * equally-positioned pair in the lists. */ - zipWith(fn: (x: T, y: U) => TResult, list1: ReadonlyArray, list2: ReadonlyArray): TResult[]; - zipWith(fn: (x: T, y: U) => TResult, list1: ReadonlyArray): (list2: ReadonlyArray) => TResult[]; - zipWith(fn: (x: T, y: U) => TResult): (list1: ReadonlyArray, list2: ReadonlyArray) => TResult[]; + zipWith(fn: (x: T, y: U) => TResult, list1: T[], list2: U[]): TResult[]; + zipWith(fn: (x: T, y: U) => TResult, list1: T[]): (list2: U[]) => TResult[]; + zipWith(fn: (x: T, y: U) => TResult): (list1: T[], list2: U[]) => TResult[]; } } diff --git a/types/ramda/package.json b/types/ramda/package.json index 57a474b0ef..8b9e44f8d9 100644 --- a/types/ramda/package.json +++ b/types/ramda/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "ts-toolbelt": "^3.8.4" + "ts-toolbelt": "^3.8.75" } }