diff --git a/when/when-tests.ts b/when/when-tests.ts index 07ade2c996..6ed82dd32d 100644 --- a/when/when-tests.ts +++ b/when/when-tests.ts @@ -164,6 +164,9 @@ promise = when(1).catch((err: any) => when(2)); promise = when(1).catch((err: any) => err.good, (err: any) => 2); promise = when(1).catch((err: any) => err.good, (err: any) => when(2)); +promise = when(1).catch(Error, (err: any) => 2); +promise = when(1).catch(Error, (err: any) => when(2)); + //TODO: error constructor predicate promise = when(1).otherwise((err: any) => 2); diff --git a/when/when.d.ts b/when/when.d.ts index f646ce7d4f..7ec7213902 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -174,7 +174,7 @@ declare module When { // Make sure you test any usage of these overloads, exceptionType must // be a constructor with prototype set to an instance of Error. - catch(exceptionType: any, onRejected?: (reason: any) => Promise): Promise; + catch(exceptionType: any, onRejected?: (reason: any) => U | Promise): Promise; finally(onFulfilledOrRejected: Function): Promise;