From fff62884caad593567558d422cf0f15728fa488b Mon Sep 17 00:00:00 2001 From: Krantisinh Deshmukh Date: Mon, 4 Feb 2019 12:57:43 +0530 Subject: [PATCH] [Ramda] - Improved type signatures of R.move. --- types/ramda/index.d.ts | 6 ++++-- types/ramda/ramda-tests.ts | 12 ++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index a35b2612ee..05b629137d 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -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; + move(from: number, to: number, list: ReadonlyArray): T[]; + move(from: number, to: number): (list: ReadonlyArray) => T[]; + move(from: number): ((to: number, list: ReadonlyArray) => T[]); /** * Wraps a function of any arity (including nullary) in a function that accepts exactly n parameters. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 87c4c7a099..6c568d4a56 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -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(0, 2, sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f'] + R.move(-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(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(2, sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f'] }; () => {