mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
[ramda] Add type for string-based reverse (#23927)
* Add type for string-based reverse * Add test for string-based reverse * Use separate documentation for each overload
This commit is contained in:
4
types/ramda/index.d.ts
vendored
4
types/ramda/index.d.ts
vendored
@@ -1601,6 +1601,10 @@ declare namespace R {
|
||||
* Returns a new list with the same elements as the original list, just in the reverse order.
|
||||
*/
|
||||
reverse<T>(list: ReadonlyArray<T>): T[];
|
||||
/**
|
||||
* Returns a new string with the characters in reverse order.
|
||||
*/
|
||||
reverse(str: string): string;
|
||||
|
||||
/**
|
||||
* Scan is similar to reduce, but returns a list of successively reduced values from the left.
|
||||
|
||||
@@ -977,6 +977,13 @@ type Pair = KeyValuePair<string, number>;
|
||||
R.reverse([]); // => []
|
||||
};
|
||||
|
||||
() => {
|
||||
R.reverse('abc'); // => 'cba'
|
||||
R.reverse('ab'); // => 'ba'
|
||||
R.reverse('a'); // => 'a'
|
||||
R.reverse(''); // => ''
|
||||
};
|
||||
|
||||
() => {
|
||||
const numbers = [1, 2, 3, 4];
|
||||
R.scan(R.multiply, 1, numbers); // => [1, 1, 2, 6, 24]
|
||||
|
||||
Reference in New Issue
Block a user