mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
Merge pull request #4243 from fchiron/master
Add signature for promise.tap(onFulfilled)
This commit is contained in:
@@ -64,6 +64,15 @@ Q.allResolved([])
|
||||
})
|
||||
});
|
||||
|
||||
Q(42)
|
||||
.tap(() => "hello")
|
||||
.tap(x => {
|
||||
console.log(x);
|
||||
})
|
||||
.then(x => {
|
||||
console.log("42 == " + x);
|
||||
});
|
||||
|
||||
declare var arrayPromise: Q.IPromise<number[]>;
|
||||
declare var stringPromise: Q.IPromise<string>;
|
||||
declare function returnsNumPromise(text: string): Q.Promise<number>;
|
||||
|
||||
@@ -122,6 +122,12 @@ declare module Q {
|
||||
* A sugar method, equivalent to promise.then(function () { throw reason; }).
|
||||
*/
|
||||
thenReject(reason: any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Attaches a handler that will observe the value of the promise when it becomes fulfilled, returning a promise for that same value, perhaps deferred but not replaced by the promise returned by the onFulfilled handler.
|
||||
*/
|
||||
tap(onFulfilled: (value: T) => any): Promise<T>;
|
||||
|
||||
timeout(ms: number, message?: string): Promise<T>;
|
||||
/**
|
||||
* Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed.
|
||||
|
||||
Reference in New Issue
Block a user