mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Ramda: Fix splitAt signature
- `splitAt` accepts either arrays or strings, not any arbitrary T. - the output will always be an array of two elements, so switched to using the tuple syntax there. - ensures that the overloading after first partial application works http://ramdajs.com/docs/#splitAt fixup splitat
This commit is contained in:
10
types/ramda/index.d.ts
vendored
10
types/ramda/index.d.ts
vendored
@@ -1644,10 +1644,12 @@ 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.
|
||||
|
||||
@@ -1899,6 +1899,7 @@ 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']
|
||||
};
|
||||
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user