mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Improved typings for the following functions: countBy, keys, sortBy, toPairs, values
This commit is contained in:
12
types/ramda/index.d.ts
vendored
12
types/ramda/index.d.ts
vendored
@@ -422,8 +422,8 @@ declare namespace R {
|
||||
* the list. Note that all keys are coerced to strings because of how
|
||||
* JavaScript objects work.
|
||||
*/
|
||||
countBy(fn: (a: any) => string | number, list: any[]): any;
|
||||
countBy(fn: (a: any) => string | number): (list: any[]) => any;
|
||||
countBy<T>(fn: (a: T) => string | number, list: T[]): { [index: string]: number };
|
||||
countBy<T>(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.
|
||||
@@ -842,7 +842,7 @@ declare namespace R {
|
||||
* Returns a list containing the names of all the enumerable own
|
||||
* properties of the supplied object.
|
||||
*/
|
||||
keys<T>(x: T): string[];
|
||||
keys<T>(x: T): Array<keyof T>;
|
||||
|
||||
/**
|
||||
* Returns a list containing the names of all the
|
||||
@@ -1587,7 +1587,7 @@ declare namespace R {
|
||||
/**
|
||||
* Sorts the list according to a key generated by the supplied function.
|
||||
*/
|
||||
sortBy<T>(fn: (a: any) => Ord, list: T[]): T[];
|
||||
sortBy<T>(fn: (a: T) => Ord, list: T[]): T[];
|
||||
sortBy(fn: (a: any) => Ord): <T>(list: T[]) => T[];
|
||||
|
||||
/**
|
||||
@@ -1736,7 +1736,7 @@ declare namespace R {
|
||||
* Note that the order of the output array is not guaranteed to be
|
||||
* consistent across different JS platforms.
|
||||
*/
|
||||
toPairs<F, S>(obj: { [k: string]: S } | { [k: number]: S } | any): Array<[F, S]>;
|
||||
toPairs<T>(obj: T): Array<[keyof T, T[keyof T]]>;
|
||||
|
||||
/**
|
||||
* Converts an object into an array of key, value arrays.
|
||||
@@ -1916,7 +1916,7 @@ declare namespace R {
|
||||
* Note that the order of the output array is not guaranteed across
|
||||
* different JS platforms.
|
||||
*/
|
||||
values<T>(obj: { [index: string]: T } | any): T[];
|
||||
values<T>(obj: T): T[keyof T];
|
||||
|
||||
/**
|
||||
* Returns a list of all the properties, including prototype properties, of the supplied
|
||||
|
||||
@@ -1557,7 +1557,7 @@ class Rectangle {
|
||||
};
|
||||
|
||||
() => {
|
||||
const a = R.toPairs<string, number>({a: 1, b: 2, c: 3}); // => [['a', 1], ['b', 2], ['c', 3]]
|
||||
const a = R.toPairs({a: 1, b: 2, c: 3}); // => [['a', 1], ['b', 2], ['c', 3]]
|
||||
};
|
||||
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user