mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge pull request #22220 from googol/ramda/signature-fixes
Ramda: Fix signatures for nth, splitAt and splitEvery
This commit is contained in:
commit
696158d8eb
20
types/ramda/index.d.ts
vendored
20
types/ramda/index.d.ts
vendored
@ -1148,8 +1148,8 @@ declare namespace R {
|
||||
/**
|
||||
* Returns the nth element in a list.
|
||||
*/
|
||||
nth<T>(n: number, list: ReadonlyArray<T>): T;
|
||||
nth(n: number): <T>(list: ReadonlyArray<T>) => T;
|
||||
nth<T>(n: number, list: ReadonlyArray<T>): T | undefined;
|
||||
nth(n: number): <T>(list: ReadonlyArray<T>) => T | undefined;
|
||||
|
||||
/**
|
||||
* Returns a function which returns its nth argument.
|
||||
@ -1643,16 +1643,22 @@ declare namespace R {
|
||||
/**
|
||||
* Splits a given list or string at a given index.
|
||||
*/
|
||||
splitAt<T>(index: number, list: T): T[];
|
||||
splitAt(index: number): <T>(list: T) => T[];
|
||||
splitAt<T>(index: number, list: ReadonlyArray<T>): T[][];
|
||||
splitAt(index: number): <T>(list: ReadonlyArray<T>) => T[][];
|
||||
splitAt<T>(index: number, list: ReadonlyArray<T>): [T[], T[]];
|
||||
splitAt(index: number, list: string): [string, string];
|
||||
splitAt(index: number): {
|
||||
<T>(list: ReadonlyArray<T>): [T[], T[]];
|
||||
(list: string): [string, string];
|
||||
};
|
||||
|
||||
/**
|
||||
* Splits a collection into slices of the specified length.
|
||||
*/
|
||||
splitEvery<T>(a: number, list: ReadonlyArray<T>): T[][];
|
||||
splitEvery(a: number): <T>(list: ReadonlyArray<T>) => T[][];
|
||||
splitEvery(a: number, list: string): string[];
|
||||
splitEvery(a: number): {
|
||||
(list: string): string[];
|
||||
<T>(list: ReadonlyArray<T>): T[][];
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a list and a predicate and returns a pair of lists with the following properties:
|
||||
|
||||
@ -1899,6 +1899,14 @@ class Rectangle {
|
||||
const b: number[][] = R.splitAt(1)([1, 2, 3]); // => [[1], [2, 3]]
|
||||
const c: string[] = R.splitAt(5, "hello world"); // => ['hello', ' world']
|
||||
const d: string[] = R.splitAt(-1, "foobar"); // => ['fooba', 'r']
|
||||
const e: string[] = R.splitAt(-1)("foobar"); // => ['fooba', 'r']
|
||||
};
|
||||
|
||||
() => {
|
||||
const a: number[][] = R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); // => [[1, 2, 3], [4, 5, 6], [7]]
|
||||
const b: number[][] = R.splitEvery(3)([1, 2, 3, 4, 5, 6, 7]); // => [[1, 2, 3], [4, 5, 6], [7]]
|
||||
const c: string[] = R.splitEvery(3, 'foobarbaz'); // => ['foo', 'bar', 'baz']
|
||||
const d: string[] = R.splitEvery(3)('foobarbaz'); // => ['foo', 'bar', 'baz']
|
||||
};
|
||||
|
||||
() => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user