From cc7b89066ea6e2b0708c9edb390ca2823ae87bdc Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Fri, 28 Nov 2014 10:06:54 +1300 Subject: [PATCH 1/3] Add in lambda filtered catches --- when/when.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/when/when.d.ts b/when/when.d.ts index 2af3fba9d6..3b7d114f7d 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -56,6 +56,9 @@ declare module When { } interface Promise { + catch(filter: (reason: any) => Boolean, onRejected?: (reason: any) => Promise): Promise; + catch(filter: (reason: any) => Boolean, onRejected?: (reason: any) => U): Promise; + catch(onRejected?: (reason: any) => Promise): Promise; catch(onRejected?: (reason: any) => U): Promise; From b4de4226784d5f9ae48d5c78515f8499d11a507c Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Thu, 4 Dec 2014 08:40:44 +1300 Subject: [PATCH 2/3] Add exception type filter using any --- when/when.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/when/when.d.ts b/when/when.d.ts index 3b7d114f7d..ca2400fc5a 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -56,6 +56,11 @@ declare module When { } interface Promise { + // 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; + catch(filter: (reason: any) => Boolean, onRejected?: (reason: any) => Promise): Promise; catch(filter: (reason: any) => Boolean, onRejected?: (reason: any) => U): Promise; From efb0ee0e4f38e7b45c370a57ef0dc6ab71274918 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Thu, 4 Dec 2014 08:42:11 +1300 Subject: [PATCH 3/3] Change Boolean to boolean --- when/when.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/when/when.d.ts b/when/when.d.ts index ca2400fc5a..60d569a17f 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -61,8 +61,8 @@ declare module When { catch(exceptionType: any, onRejected?: (reason: any) => Promise): Promise; catch(exceptionType: any, onRejected?: (reason: any) => U): Promise; - catch(filter: (reason: any) => Boolean, onRejected?: (reason: any) => Promise): Promise; - catch(filter: (reason: any) => Boolean, onRejected?: (reason: any) => U): Promise; + catch(filter: (reason: any) => boolean, onRejected?: (reason: any) => Promise): Promise; + catch(filter: (reason: any) => boolean, onRejected?: (reason: any) => U): Promise; catch(onRejected?: (reason: any) => Promise): Promise; catch(onRejected?: (reason: any) => U): Promise;