Skip to content

Commit

Permalink
update invoker function signature
Browse files Browse the repository at this point in the history
  • Loading branch information
raynerpupo committed Dec 20, 2017
1 parent f87e32c commit 18ebf4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions types/ramda/index.d.ts
Expand Up @@ -11,6 +11,7 @@
// Charles-Philippe Clermont <https://github.com/charlespwd>
// Samson Keung <https://github.com/samsonkeung>
// Angelo Ocana <https://github.com/angeloocana>
// Rayner Pupo <https://github.com/raynerd>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4

Expand Down Expand Up @@ -812,15 +813,13 @@ declare namespace R {
invertObj(obj: { [index: string]: string } | { [index: number]: string }): { [index: string]: string };

/**
* Turns a named method of an object (or object prototype) into a function that can be
* called directly. Passing the optional `len` parameter restricts the returned function to
* the initial `len` parameters of the method.
* Turns a named method with a specified arity into a function that can be called directly
* supplied with arguments and a target object.
*
* The returned function is curried and accepts `len + 1` parameters (or `method.length + 1`
* when `len` is not specified), and the final parameter is the target object.
* The returned function is curried and accepts `arity + 1` parameters where the final
* parameter is the target object.
*/
invoker(name: string, obj: any, len?: number): (...a: any[]) => any;
invoker(name: string): (obj: any, len?: number) => (...a: any[]) => any;
invoker(arity: number, method: string): (...a: any[]) => any;

/**
* See if an object (`val`) is an instance of the supplied constructor.
Expand Down
4 changes: 2 additions & 2 deletions types/ramda/ramda-tests.ts
Expand Up @@ -202,8 +202,8 @@ class F2 {
};

() => {
R.invoker("charAt", String.prototype);
R.invoker("charAt", String.prototype, 1);
R.invoker(1, "slice")(6, "abcdefghijklm");
R.invoker(2, "slice")(6)(8, "abcdefghijklm");
};

(() => {
Expand Down

0 comments on commit 18ebf4d

Please sign in to comment.