@type/ramda: Add type definition for startsWith (#20594)

* added type definition for startsWith in Ramda

* linting
This commit is contained in:
samsonkeung 2017-10-23 12:56:46 -07:00 committed by Sheetal Nandi
parent 76c122d1a4
commit 2091df4cbf
2 changed files with 14 additions and 2 deletions

View File

@ -10,6 +10,7 @@
// Jordan Quagliatini <https://github.com/1M0reBug>
// Simon Højberg <https://github.com/hojberg>
// Charles-Philippe Clermont <https://github.com/charlespwd>
// Samson Keung <https://github.com/samsonkeung>
// 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<T>(a: T | T[], list: T[]): boolean;
startsWith<T>(a: T | T[]): (list: T[]) => boolean;
/**
* Subtracts two numbers. Equivalent to `a - b` but curried.

View File

@ -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