From 18ebf4d5f82174031d3fab899c8b2936e80a2bd2 Mon Sep 17 00:00:00 2001 From: Rayner Pupo Date: Tue, 19 Dec 2017 22:31:24 -0500 Subject: [PATCH] update invoker function signature --- types/ramda/index.d.ts | 13 ++++++------- types/ramda/ramda-tests.ts | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index be97f3ee32..21ef580006 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -11,6 +11,7 @@ // Charles-Philippe Clermont // Samson Keung // Angelo Ocana +// Rayner Pupo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -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. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 1315ced585..5ce9bb40d3 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -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"); }; (() => {