mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 01:31:45 +00:00
[Ramda] - Improved type signatures of R.move.
This commit is contained in:
Vendored
+4
-2
@@ -1578,10 +1578,12 @@ declare namespace R {
|
||||
multiply(a: number): (b: number) => number;
|
||||
|
||||
/**
|
||||
* Moves an item, at index `from`, to index `to`, in a list of elements.
|
||||
* 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: CurriedFunction3<number, number, any[], any[]>;
|
||||
move<T>(from: number, to: number, list: ReadonlyArray<T>): T[];
|
||||
move(from: number, to: number): <T>(list: ReadonlyArray<T>) => T[];
|
||||
move(from: number): (<T>(to: number, list: ReadonlyArray<T>) => T[]);
|
||||
|
||||
/**
|
||||
* Wraps a function of any arity (including nullary) in a function that accepts exactly n parameters.
|
||||
|
||||
@@ -1118,18 +1118,14 @@ interface Obj {
|
||||
() => {
|
||||
const sampleList = ['a', 'b', 'c', 'd', 'e', 'f'];
|
||||
|
||||
R.move(0, 2, sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
R.move(-1, 0, sampleList); // => ['f', 'a', 'b', 'c', 'd', 'e'] list rotation
|
||||
R.move<string>(0, 2, sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
R.move<string>(-1, 0, sampleList); // => ['f', 'a', 'b', 'c', 'd', 'e'] list rotation
|
||||
|
||||
const moveCurried1 = R.move(0, 2);
|
||||
moveCurried1(sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
moveCurried1<string>(sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
|
||||
const moveCurried2 = R.move(0);
|
||||
moveCurried2(2, sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
|
||||
const moveCurried3 = R.move(0);
|
||||
const moveCurried4 = moveCurried3(2);
|
||||
moveCurried4(sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
moveCurried2<string>(2, sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
};
|
||||
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user