From cfc3e22a3d3e373903c8a4db515014ede84f9deb Mon Sep 17 00:00:00 2001 From: Jared Klopper Date: Tue, 3 Nov 2015 12:56:46 +1300 Subject: [PATCH] Allow nodeFn.apply to accept an IArguments in addition to arrays --- when/when-tests.ts | 4 ++++ when/when.d.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/when/when-tests.ts b/when/when-tests.ts index 267493dd56..cdf252de88 100644 --- a/when/when-tests.ts +++ b/when/when-tests.ts @@ -380,6 +380,10 @@ example = function () { promise = nodefn.apply(nodeFn2, [1, '2']); +example = function() { + nodefn.apply(fs.read, arguments); +} + example = function () { var loadPasswd = nodefn.apply(fs.readFile, ['/etc/passwd']); diff --git a/when/when.d.ts b/when/when.d.ts index a9166ab62d..f2c194c07e 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -316,12 +316,12 @@ declare module "when/node" { ): when.Promise; - function apply(fn: _.NodeFn0, args: any[]): when.Promise; - function apply(fn: _.NodeFn1, args: any[]): when.Promise; - function apply(fn: _.NodeFn2, args: any[]): when.Promise; - function apply(fn: _.NodeFn3, args: any[]): when.Promise; - function apply(fn: _.NodeFn4, args: any[]): when.Promise; - function apply(fn: _.NodeFn5, args: any[]): when.Promise; + function apply(fn: _.NodeFn0, args: any[] | IArguments): when.Promise; + function apply(fn: _.NodeFn1, args: any[] | IArguments): when.Promise; + function apply(fn: _.NodeFn2, args: any[] | IArguments): when.Promise; + function apply(fn: _.NodeFn3, args: any[] | IArguments): when.Promise; + function apply(fn: _.NodeFn4, args: any[] | IArguments): when.Promise; + function apply(fn: _.NodeFn5, args: any[] | IArguments): when.Promise; function liftAll(srcApi: any, transform?: (destApi: any, liftedFunc: Function, name: string) => any, destApi?: any): any;