From 6824b8c8e619c340c360f25f3909ff9e8ac792fc Mon Sep 17 00:00:00 2001 From: Eric Nicholson Date: Tue, 10 Nov 2015 20:21:43 -0500 Subject: [PATCH] Allow calls to fromNode without a result parameter in the callback --- bluebird/bluebird-tests.ts | 2 ++ bluebird/bluebird.d.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index ade461074..440743c03 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -150,6 +150,7 @@ var BlueBird: typeof Promise; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - var nodeCallbackFunc = (callback: (err: any, result: string) => void) => {} +var nodeCallbackFuncErrorOnly = (callback: (err: any) => void) => {} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -678,6 +679,7 @@ func = Promise.promisify(f, obj); obj = Promise.promisifyAll(obj); anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback)); +anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback)); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 878e1051e..67067dc5b 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -426,7 +426,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { /** * Returns a promise that is resolved by a node style callback function. */ - static fromNode(resolver: (callback: (err: any, result: any) => void) => void): Promise; + static fromNode(resolver: (callback: (err: any, result?: any) => void) => void): Promise; /** * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.