diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 776c074b73..0897dda51f 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -10,6 +10,7 @@ // Jordan Quagliatini // Simon HĂžjberg // Charles-Philippe Clermont +// Samson Keung // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -1638,8 +1639,10 @@ declare namespace R { /** * Checks if a list starts with the provided values */ - startsWith(a: any, list: any): boolean; - startsWith(a: any): (list: any) => boolean; + startsWith(a: string, list: string): boolean; + startsWith(a: string): (list: string) => boolean; + startsWith(a: T | T[], list: T[]): boolean; + startsWith(a: T | T[]): (list: T[]) => boolean; /** * Subtracts two numbers. Equivalent to `a - b` but curried. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 973edf29e3..fdf53e7ab4 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1883,6 +1883,15 @@ class Rectangle { const b: number[][] = R.splitWhen(R.equals(2))([1, 2, 3, 1, 2, 3]); // => [[1], [2, 3, 1, 2, 3]] }; +() => { + R.startsWith("a", "abc"); // => true + R.startsWith("a")("abc"); // => true + R.startsWith(1, [1, 2, 3]); // => true + R.startsWith(1)([1, 2, 3]); // => true + R.startsWith([1], [1, 2, 3]); // => true + R.startsWith([1])([1, 2, 3]); // => true +}; + () => { R.add(2, 3); // => 5 R.add(7)(10); // => 17