diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index ff4b85e2e..e5d83db7a 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -264,6 +264,12 @@ fooProm = fooProm.finally((value: Foo) => { // return is ignored return fooThen; }); +fooProm = fooProm.finally((value: Foo) => { + // return is ignored +}); +fooProm = fooProm.finally(() => { + // return is ignored +}); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -275,6 +281,12 @@ fooProm = fooProm.lastly((value: Foo) => { // return is ignored return fooThen; }); +fooProm = fooProm.lastly((value: Foo) => { + // return is ignored +}); +fooProm = fooProm.lastly(() => { + // return is ignored +}); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -408,6 +420,9 @@ anyProm = fooProm.call(str, 1, 2, 3); barProm = fooProm.return(bar); barProm = fooProm.thenReturn(bar); +voidProm = fooProm.return(); +voidProm = fooProm.thenReturn(); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // fooProm diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 13494cb82..0d57e49b0 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -6,9 +6,8 @@ // ES6 model with generics overload was sourced and trans-multiplied from es6-promises.d.ts // By: Campredon -// Warning: recommended to use `tsc > v1.0.0` (critical bugs in generic code: +// Warning: recommended to use `tsc > v0.9.7` (critical bugs in earlier generic code): // - https://github.com/borisyankov/DefinitelyTyped/issues/1563 -// - https://github.com/borisyankov/DefinitelyTyped/tree/def/bluebird // Note: replicate changes to all overloads in both definition and test file // Note: keep both static and instance members inline (so similar) @@ -75,9 +74,11 @@ declare class Promise implements Promise.Thenable { */ finally(handler: (value: R) => Promise.Thenable): Promise; finally(handler: (value: R) => R): Promise; + finally(handler: (value: R) => void): Promise; lastly(handler: (value: R) => Promise.Thenable): Promise; lastly(handler: (value: R) => R): Promise; + lastly(handler: (value: R) => void): Promise; /** * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. @@ -212,8 +213,10 @@ declare class Promise implements Promise.Thenable { * * Alias `.thenReturn();` for compatibility with earlier ECMAScript version. */ - return(value?: U): Promise; - thenReturn(value?: U): Promise; + return(value: U): Promise; + thenReturn(value: U): Promise; + return(): Promise; + thenReturn(): Promise; /** * Convenience method for: @@ -341,7 +344,7 @@ declare module Promise { * * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. */ - // TODO specify resolver callback + // TODO specify resolver callback callback: Function; }