mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-23 04:47:24 +08:00
bluebird: more strict .catch definitions
This commit is contained in:
@@ -338,6 +338,17 @@ fooOrBarProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
{
|
||||
class CustomError extends Error {
|
||||
public customField: number;
|
||||
}
|
||||
fooProm = fooProm.catch(CustomError, reason => {
|
||||
let a: number = reason.customField
|
||||
})
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.error((reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
13
bluebird/bluebird.d.ts
vendored
13
bluebird/bluebird.d.ts
vendored
@@ -71,14 +71,19 @@ class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R> {
|
||||
*/
|
||||
catch(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
|
||||
caught(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
|
||||
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
|
||||
catch(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
|
||||
caught(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
|
||||
|
||||
catch<E>(ErrorClass: new () => E, onReject: (error: E) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
|
||||
caught<E>(ErrorClass: new () => E, onReject: (error: E) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
|
||||
|
||||
catch<E, U>(ErrorClass: new () => E, onReject: (error: E) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
|
||||
caught<E, U>(ErrorClass: new () => E, onReject: (error: E) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
|
||||
|
||||
catch(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
|
||||
caught(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
|
||||
|
||||
catch<U>(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
|
||||
caught<U>(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user