diff --git a/types/ramda/es/includes.d.ts b/types/ramda/es/includes.d.ts new file mode 100644 index 0000000000..b6b04d949f --- /dev/null +++ b/types/ramda/es/includes.d.ts @@ -0,0 +1,2 @@ +import { includes } from '../index'; +export default includes; diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 48888c6ee5..3b4fc67711 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -269,6 +269,7 @@ /// /// /// +/// declare let R: R.Static; @@ -1129,6 +1130,12 @@ declare namespace R { */ inc(n: number): number; + /** + * Given a target, this function checks a list for a target and returns a boolean. + */ + includes(target: T, list: ReadonlyArray): boolean; + includes(target: T): (list: ReadonlyArray) => boolean; + /** * Given a function that generates a key, turns a list of objects into an object indexing the objects * by the given key. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 2bd9a55d2f..e02f5605e8 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -971,6 +971,11 @@ interface Obj { )(list); }); +() => { + R.includes(8, [1, 8]); // => true + R.includes(10)([1, 2, 3, 4]); // => false +}; + () => { R.indexOf(3, [1, 2, 3, 4]); // => 2 R.indexOf(10)([1, 2, 3, 4]); // => -1