From 49121b4215bfc5c377b00db46321aeb8d2d9fd12 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Tue, 30 Oct 2018 17:31:19 -0400 Subject: [PATCH 01/21] added R.__ (placeholder arg for currying) --- types/ramda/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 9375c3107b..0295396091 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -436,6 +436,12 @@ declare namespace R { } interface Static { +/** + * Placeholder. When used with functions like curry, or op, the second argument is applied to the second + * position, and it returns a function waiting for its first argument. + */ + __: any; /* This is used in examples throughout the docs, but I it only seems to be directly explained here: https://ramdajs.com/0.9/docs/#op */ + /** * Adds two numbers (or strings). Equivalent to a + b but curried. */ From 5528d0b56364110f9aee995cd6a9b5b6312e737d Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 10:58:33 -0400 Subject: [PATCH 02/21] updated Placeholder type --- types/ramda/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 0295396091..3bd749ddaf 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -430,6 +430,8 @@ declare namespace R { (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6): R; } + interface Placeholder { __isRamdaPlaceholder__: true } + interface Reduced { '@@transducer/value': T; '@@transducer/reduced': true; @@ -440,7 +442,7 @@ declare namespace R { * Placeholder. When used with functions like curry, or op, the second argument is applied to the second * position, and it returns a function waiting for its first argument. */ - __: any; /* This is used in examples throughout the docs, but I it only seems to be directly explained here: https://ramdajs.com/0.9/docs/#op */ + __: Placeholder; /* This is used in examples throughout the docs, but I it only seems to be directly explained here: https://ramdajs.com/0.9/docs/#op */ /** * Adds two numbers (or strings). Equivalent to a + b but curried. From b27869120516ba9d4e5ca70c87d5a61df4e56996 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 10:59:02 -0400 Subject: [PATCH 03/21] updated concat definition to include placeholder signature --- types/ramda/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 3bd749ddaf..ba6c87e86d 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -762,6 +762,7 @@ declare namespace R { * Returns a new list consisting of the elements of the first list followed by the elements * of the second. */ + concat(placeholder: Placeholder): (list1: ReadonlyArray, list2: ReadonlyArray) => T[]; concat(list1: ReadonlyArray, list2: ReadonlyArray): T[]; concat(list1: ReadonlyArray): (list2: ReadonlyArray) => T[]; concat(list1: string, list2: string): string; From c0375340be04e6b6c0f47a02a2305b402260eecd Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 10:59:39 -0400 Subject: [PATCH 04/21] updated contains to include placeholder signature --- types/ramda/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index ba6c87e86d..1cce7059c1 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -791,6 +791,7 @@ declare namespace R { * Returns `true` if the specified item is somewhere in the list, `false` otherwise. * Equivalent to `indexOf(a)(list) > -1`. Uses strict (`===`) equality checking. */ + contains(__: Placeholder): (list: ReadonlyArray, a: T) => boolean; contains(a: string, list: string): boolean; contains(a: T, list: ReadonlyArray): boolean; contains(a: string): (list: string) => boolean; From a456a071d8453e72f77b4eb2aaebad45c1359cb6 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 10:59:54 -0400 Subject: [PATCH 05/21] added tests for concat and contains from ramda docs --- types/ramda/ramda-tests.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 951c11ba02..755bee72fd 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -124,6 +124,12 @@ class F2 { } }; +/** R.__ */ +() => { + R.concat(R.__)([4, 5, 6], [1, 2, 3]); //=> [1, 2, 3, 4, 5, 6] + R.contains(R.__)([1, 2, 3], 3) //=> true +}; + () => { const addFour = (a: number) => (b: number) => (c: number) => (d: number) => a + b + c + d; const uncurriedAddFour = R.uncurryN(4, addFour); From 855dc658d9761e57b127e029d83319171f78aee1 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 13:52:49 -0400 Subject: [PATCH 06/21] linting --- types/ramda/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 1cce7059c1..29d95d54dd 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -430,7 +430,7 @@ declare namespace R { (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6): R; } - interface Placeholder { __isRamdaPlaceholder__: true } + interface Placeholder { __isRamdaPlaceholder__: true; } interface Reduced { '@@transducer/value': T; @@ -438,7 +438,7 @@ declare namespace R { } interface Static { -/** + /** * Placeholder. When used with functions like curry, or op, the second argument is applied to the second * position, and it returns a function waiting for its first argument. */ From 5d9d9f9dffd4a323a5418beead67c24b5e3c6ef7 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 15:29:24 -0400 Subject: [PATCH 07/21] added placeholder signature to divide --- types/ramda/index.d.ts | 1 + types/ramda/ramda-tests.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 29d95d54dd..270d9a1e03 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -886,6 +886,7 @@ declare namespace R { /** * Divides two numbers. Equivalent to a / b. */ + divide(__: Placeholder, b: number): (a: number) => number; divide(a: number, b: number): number; divide(a: number): (b: number) => number; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 755bee72fd..49bc1d35c1 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -126,8 +126,10 @@ class F2 { /** R.__ */ () => { - R.concat(R.__)([4, 5, 6], [1, 2, 3]); //=> [1, 2, 3, 4, 5, 6] - R.contains(R.__)([1, 2, 3], 3) //=> true + R.concat(R.__)([4, 5, 6], [1, 2, 3]); // [1, 2, 3, 4, 5, 6] + R.contains(R.__)([1, 2, 3], 3); // true + R.divide(R.__, 2)(42); // 21 + }; () => { From d01b454f91e4387ebe652068983aefee56cf6394 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 18:23:51 -0400 Subject: [PATCH 08/21] updated contains definition --- types/ramda/index.d.ts | 7 +++++-- types/ramda/ramda-tests.ts | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 270d9a1e03..7557a96d73 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -762,7 +762,8 @@ declare namespace R { * Returns a new list consisting of the elements of the first list followed by the elements * of the second. */ - concat(placeholder: Placeholder): (list1: ReadonlyArray, list2: ReadonlyArray) => T[]; + concat(placeholder: Placeholder): (list2: ReadonlyArray, list1: ReadonlyArray) => T[]; + concat(placeholder: Placeholder, list2: ReadonlyArray): (list1: ReadonlyArray) => T[]; concat(list1: ReadonlyArray, list2: ReadonlyArray): T[]; concat(list1: ReadonlyArray): (list2: ReadonlyArray) => T[]; concat(list1: string, list2: string): string; @@ -791,7 +792,8 @@ declare namespace R { * Returns `true` if the specified item is somewhere in the list, `false` otherwise. * Equivalent to `indexOf(a)(list) > -1`. Uses strict (`===`) equality checking. */ - contains(__: Placeholder): (list: ReadonlyArray, a: T) => boolean; + contains(__: Placeholder, list: string): (a: string) => boolean; + contains(__: Placeholder, list: T[]): (a: T) => boolean; contains(a: string, list: string): boolean; contains(a: T, list: ReadonlyArray): boolean; contains(a: string): (list: string) => boolean; @@ -1064,6 +1066,7 @@ declare namespace R { /** * Returns true if the first parameter is greater than the second. */ + gt(__: Placeholder, b: number): (a: number) => boolean; gt(a: number, b: number): boolean; gt(a: number): (b: number) => boolean; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 49bc1d35c1..c3a54a9838 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -126,10 +126,11 @@ class F2 { /** R.__ */ () => { + R.concat(R.__, [4, 5, 6])([1, 2, 3]); // [1, 2, 3, 4, 5, 6] R.concat(R.__)([4, 5, 6], [1, 2, 3]); // [1, 2, 3, 4, 5, 6] - R.contains(R.__)([1, 2, 3], 3); // true + R.contains(R.__, [1, 2, 3])(3); // true R.divide(R.__, 2)(42); // 21 - + R.gt(R.__, 2)(10); // true }; () => { From 3e1991ec6186b2a184ab5983f1bf652598dc6642 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 18:30:31 -0400 Subject: [PATCH 09/21] updated has to include placeholder definition --- types/ramda/index.d.ts | 1 + types/ramda/ramda-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 7557a96d73..587536ebd5 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1079,6 +1079,7 @@ declare namespace R { /** * Returns whether or not an object has an own property with the specified name. */ + has(__: Placeholder, obj: T): (s: string) => boolean; has(s: string, obj: T): boolean; has(s: string): (obj: T) => boolean; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index c3a54a9838..b0140f3c04 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -131,6 +131,7 @@ class F2 { R.contains(R.__, [1, 2, 3])(3); // true R.divide(R.__, 2)(42); // 21 R.gt(R.__, 2)(10); // true + R.has(R.__, {x: 0, y: 0})('x'); // true; }; () => { From 7a5ef000dc904bdec879edc1a032a7351905a2a7 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 18:33:32 -0400 Subject: [PATCH 10/21] updated mathMod to include placeholder definition --- types/ramda/index.d.ts | 1 + types/ramda/ramda-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 587536ebd5..4795bfe23b 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1376,6 +1376,7 @@ declare namespace R { * mathMod(-17, 5) is 3. mathMod requires Integer arguments, and returns NaN * when the modulus is zero or negative. */ + mathMod(__: Placeholder, b: number): (a: number) => number; mathMod(a: number, b: number): number; mathMod(a: number): (b: number) => number; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index b0140f3c04..e0d170ed52 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -132,6 +132,7 @@ class F2 { R.divide(R.__, 2)(42); // 21 R.gt(R.__, 2)(10); // true R.has(R.__, {x: 0, y: 0})('x'); // true; + R.mathMod(R.__, 12)(15); // 3 }; () => { From 430e4c0c9a8c0371eef2010fccf38a284a5c4862 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 31 Oct 2018 18:38:30 -0400 Subject: [PATCH 11/21] updated merge to include placeholder definition --- types/ramda/index.d.ts | 1 + types/ramda/ramda-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 4795bfe23b..efe79e631f 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1425,6 +1425,7 @@ declare namespace R { * merged with the own properties of object b. * This function will *not* mutate passed-in objects. */ + merge(__: Placeholder, b: T2): (a: T1) => T1 & T2; merge(a: T1, b: T2): T1 & T2; merge(a: T1): (b: T2) => T1 & T2; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index e0d170ed52..eb437d197c 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -133,6 +133,7 @@ class F2 { R.gt(R.__, 2)(10); // true R.has(R.__, {x: 0, y: 0})('x'); // true; R.mathMod(R.__, 12)(15); // 3 + R.merge(R.__, {x: 0})({x: 5, y: 2}); // {x: 0, y: 2} }; () => { From ddbf2a078987819462bcba9079388668aa5806df Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 09:47:58 -0400 Subject: [PATCH 12/21] added placeholder definition to gte --- types/ramda/index.d.ts | 2 ++ types/ramda/ramda-tests.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index efe79e631f..72784cbff5 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1073,6 +1073,7 @@ declare namespace R { /** * Returns true if the first parameter is greater than or equal to the second. */ + gte(__: Placeholder, b: number): (a: number) => boolean; gte(a: number, b: number): boolean; gte(a: number): (b: number) => boolean; @@ -1513,6 +1514,7 @@ declare namespace R { * Note that this functions preserves the JavaScript-style behavior for * modulo. For mathematical modulo see `mathMod` */ + modulo(__: Placeholder, b: number): (a: number) => number; modulo(a: number, b: number): number; modulo(a: number): (b: number) => number; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index eb437d197c..5371520221 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -131,6 +131,7 @@ class F2 { R.contains(R.__, [1, 2, 3])(3); // true R.divide(R.__, 2)(42); // 21 R.gt(R.__, 2)(10); // true + R.gte(R.__, 6)(2); // false R.has(R.__, {x: 0, y: 0})('x'); // true; R.mathMod(R.__, 12)(15); // 3 R.merge(R.__, {x: 0})({x: 5, y: 2}); // {x: 0, y: 2} From c450a0c77c3bd1d67e7bbbbb33c4de05f28d5fa6 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 09:52:37 -0400 Subject: [PATCH 13/21] added placeholder definition to lte --- types/ramda/index.d.ts | 2 ++ types/ramda/ramda-tests.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 72784cbff5..d4839041af 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1316,12 +1316,14 @@ declare namespace R { /** * Returns true if the first parameter is less than the second. */ + lt(__: Placeholder, b: number): (a: number) => boolean; lt(a: number, b: number): boolean; lt(a: number): (b: number) => boolean; /** * Returns true if the first parameter is less than or equal to the second. */ + lte(__: Placeholder, b: number): (a: number) => boolean; lte(a: number, b: number): boolean; lte(a: number): (b: number) => boolean; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 5371520221..3854403980 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -133,6 +133,8 @@ class F2 { R.gt(R.__, 2)(10); // true R.gte(R.__, 6)(2); // false R.has(R.__, {x: 0, y: 0})('x'); // true; + R.lt(R.__, 5)(10); // false + R.lte(R.__, 2)(1); // true R.mathMod(R.__, 12)(15); // 3 R.merge(R.__, {x: 0})({x: 5, y: 2}); // {x: 0, y: 2} }; From d351787029218e9ac66fc6dd04b8fdf6acb4d674 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 09:54:18 -0400 Subject: [PATCH 14/21] added modulo test --- types/ramda/ramda-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 3854403980..b8adedbd0c 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -136,6 +136,7 @@ class F2 { R.lt(R.__, 5)(10); // false R.lte(R.__, 2)(1); // true R.mathMod(R.__, 12)(15); // 3 + R.modulo(R.__, 2)(42); // 0 R.merge(R.__, {x: 0})({x: 5, y: 2}); // {x: 0, y: 2} }; From 8c20e3d34f71b722eb4be6e26b2582e6407b7925 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 09:56:57 -0400 Subject: [PATCH 15/21] added placeholder definition to subtract --- types/ramda/index.d.ts | 1 + types/ramda/ramda-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index d4839041af..5eaef29614 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -2303,6 +2303,7 @@ declare namespace R { /** * Subtracts two numbers. Equivalent to `a - b` but curried. */ + subtract(__: Placeholder, b: number): (a: number) => number; subtract(a: number, b: number): number; subtract(a: number): (b: number) => number; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index b8adedbd0c..c370269925 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -138,6 +138,7 @@ class F2 { R.mathMod(R.__, 12)(15); // 3 R.modulo(R.__, 2)(42); // 0 R.merge(R.__, {x: 0})({x: 5, y: 2}); // {x: 0, y: 2} + R.subtract(R.__, 5)(17); // 12 }; () => { From a0dcb70486ce1a5bb3130a044d01c107a93b2a05 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 09:59:22 -0400 Subject: [PATCH 16/21] added second placeholder definition to divide --- types/ramda/index.d.ts | 1 + types/ramda/ramda-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 5eaef29614..0e4f0a1f66 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -889,6 +889,7 @@ declare namespace R { * Divides two numbers. Equivalent to a / b. */ divide(__: Placeholder, b: number): (a: number) => number; + divide(__: Placeholder): (b: number, a: number) => number; divide(a: number, b: number): number; divide(a: number): (b: number) => number; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index c370269925..612411f710 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -129,6 +129,7 @@ class F2 { R.concat(R.__, [4, 5, 6])([1, 2, 3]); // [1, 2, 3, 4, 5, 6] R.concat(R.__)([4, 5, 6], [1, 2, 3]); // [1, 2, 3, 4, 5, 6] R.contains(R.__, [1, 2, 3])(3); // true + R.divide(R.__)(2, 42); // 21 R.divide(R.__, 2)(42); // 21 R.gt(R.__, 2)(10); // true R.gte(R.__, 6)(2); // false From cb7a0a4efea23e9d3e307d6836640a41dbda6fde Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 10:11:42 -0400 Subject: [PATCH 17/21] added remaining missing placeholder defs --- types/ramda/index.d.ts | 13 +++++++++++++ types/ramda/ramda-tests.ts | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 0e4f0a1f66..57192be027 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -794,6 +794,10 @@ declare namespace R { */ contains(__: Placeholder, list: string): (a: string) => boolean; contains(__: Placeholder, list: T[]): (a: T) => boolean; + + contains(__: Placeholder): (list: string, a: string) => boolean; + contains(__: Placeholder): (list: T[], a: T) => boolean; + contains(a: string, list: string): boolean; contains(a: T, list: ReadonlyArray): boolean; contains(a: string): (list: string) => boolean; @@ -1068,6 +1072,7 @@ declare namespace R { * Returns true if the first parameter is greater than the second. */ gt(__: Placeholder, b: number): (a: number) => boolean; + gt(__: Placeholder): (b: number, a: number) => boolean; gt(a: number, b: number): boolean; gt(a: number): (b: number) => boolean; @@ -1075,6 +1080,7 @@ declare namespace R { * Returns true if the first parameter is greater than or equal to the second. */ gte(__: Placeholder, b: number): (a: number) => boolean; + gte(__: Placeholder): (b: number, a: number) => boolean; gte(a: number, b: number): boolean; gte(a: number): (b: number) => boolean; @@ -1082,6 +1088,7 @@ declare namespace R { * Returns whether or not an object has an own property with the specified name. */ has(__: Placeholder, obj: T): (s: string) => boolean; + has(__: Placeholder): (obj: T, s: string) => boolean; has(s: string, obj: T): boolean; has(s: string): (obj: T) => boolean; @@ -1318,6 +1325,7 @@ declare namespace R { * Returns true if the first parameter is less than the second. */ lt(__: Placeholder, b: number): (a: number) => boolean; + lt(__: Placeholder): (b: number, a: number) => boolean; lt(a: number, b: number): boolean; lt(a: number): (b: number) => boolean; @@ -1325,6 +1333,7 @@ declare namespace R { * Returns true if the first parameter is less than or equal to the second. */ lte(__: Placeholder, b: number): (a: number) => boolean; + lte(__: Placeholder): (b: number, a: number) => boolean; lte(a: number, b: number): boolean; lte(a: number): (b: number) => boolean; @@ -1381,6 +1390,7 @@ declare namespace R { * when the modulus is zero or negative. */ mathMod(__: Placeholder, b: number): (a: number) => number; + mathMod(__: Placeholder): (b: number, a: number) => number; mathMod(a: number, b: number): number; mathMod(a: number): (b: number) => number; @@ -1430,6 +1440,7 @@ declare namespace R { * This function will *not* mutate passed-in objects. */ merge(__: Placeholder, b: T2): (a: T1) => T1 & T2; + merge(__: Placeholder): (b: T2, a: T1) => T1 & T2; merge(a: T1, b: T2): T1 & T2; merge(a: T1): (b: T2) => T1 & T2; @@ -1518,6 +1529,7 @@ declare namespace R { * modulo. For mathematical modulo see `mathMod` */ modulo(__: Placeholder, b: number): (a: number) => number; + modulo(__: Placeholder): (b: number, a: number) => number; modulo(a: number, b: number): number; modulo(a: number): (b: number) => number; @@ -2305,6 +2317,7 @@ declare namespace R { * Subtracts two numbers. Equivalent to `a - b` but curried. */ subtract(__: Placeholder, b: number): (a: number) => number; + subtract(__: Placeholder): (b: number, a: number) => number; subtract(a: number, b: number): number; subtract(a: number): (b: number) => number; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 612411f710..749ebdaf8b 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -128,18 +128,39 @@ class F2 { () => { R.concat(R.__, [4, 5, 6])([1, 2, 3]); // [1, 2, 3, 4, 5, 6] R.concat(R.__)([4, 5, 6], [1, 2, 3]); // [1, 2, 3, 4, 5, 6] + R.contains(R.__, [1, 2, 3])(3); // true + R.contains(R.__)([1, 2, 3], 3); // true + R.divide(R.__)(2, 42); // 21 R.divide(R.__, 2)(42); // 21 + R.gt(R.__, 2)(10); // true + R.gt(R.__)(2, 10); // true + R.gte(R.__, 6)(2); // false + R.gte(R.__)(6, 2); // false + R.has(R.__, {x: 0, y: 0})('x'); // true; + R.has(R.__)({x: 0, y: 0}, 'x'); // true; + R.lt(R.__, 5)(10); // false + R.lt(R.__)(5, 10); // false + R.lte(R.__, 2)(1); // true + R.lte(R.__)(2, 1); // true + R.mathMod(R.__, 12)(15); // 3 + R.mathMod(R.__)(12, 15); // 3 + R.modulo(R.__, 2)(42); // 0 + R.modulo(R.__)(2, 42); // 0 + R.merge(R.__, {x: 0})({x: 5, y: 2}); // {x: 0, y: 2} + R.merge(R.__)({x: 0}, {x: 5, y: 2}); // {x: 0, y: 2} + R.subtract(R.__, 5)(17); // 12 + R.subtract(R.__)(5, 17); // 12 }; () => { From f0bb98ba9f70d962283da4b053a72e8dfd2793a2 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 10:15:32 -0400 Subject: [PATCH 18/21] added name to contributors --- types/ramda/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 57192be027..ad967c1c5d 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -23,6 +23,7 @@ // Marcin Biernat // Rayhaneh Banyassady // Ryan McCuaig +// Drew Wyatt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From 9f8cfb95cc50c1c069a6de7abc8afae5925736d2 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 10:19:35 -0400 Subject: [PATCH 19/21] version bump --- types/ramda/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index ad967c1c5d..979c0d8b6c 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ramda 0.25 +// Type definitions for ramda 0.9 // Project: https://github.com/donnut/typescript-ramda // Definitions by: Erwin Poeze // Tycho Grouwstra From 9b312a10ece171014b33ace44ef2d7eb2f2ee9e7 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 10:23:42 -0400 Subject: [PATCH 20/21] removed unnecessary line breaks --- types/ramda/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 979c0d8b6c..280d0f71e2 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -795,10 +795,8 @@ declare namespace R { */ contains(__: Placeholder, list: string): (a: string) => boolean; contains(__: Placeholder, list: T[]): (a: T) => boolean; - contains(__: Placeholder): (list: string, a: string) => boolean; contains(__: Placeholder): (list: T[], a: T) => boolean; - contains(a: string, list: string): boolean; contains(a: T, list: ReadonlyArray): boolean; contains(a: string): (list: string) => boolean; From f43b98a0621d49a5474ced43e8626a79217e6e40 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Thu, 1 Nov 2018 10:32:19 -0400 Subject: [PATCH 21/21] Fixed version bump I realize now this refers to the version of the *types*, not the version of ramda. --- types/ramda/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 280d0f71e2..8c099c2f89 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ramda 0.9 +// Type definitions for ramda 0.26 // Project: https://github.com/donnut/typescript-ramda // Definitions by: Erwin Poeze // Tycho Grouwstra