From 456388ff733bc50370c673feef409c98c0929983 Mon Sep 17 00:00:00 2001 From: jbblanchet Date: Mon, 24 Nov 2014 17:43:17 -0500 Subject: [PATCH 1/2] Add when signature for Promise --- q/Q.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/q/Q.d.ts b/q/Q.d.ts index 59e891c52..8dbf93450 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -188,6 +188,9 @@ declare module Q { reason?: any; } + // If no value provided, returned promise will be of void type + export function when(): Promise; + // if no fulfill, reject, or progress provided, returned promise will be of same type export function when(value: IPromise): Promise; export function when(value: T): Promise; From c85918d0e84747ec5fa5c8d397a1aa2fcfb00306 Mon Sep 17 00:00:00 2001 From: jbblanchet Date: Mon, 24 Nov 2014 18:37:56 -0500 Subject: [PATCH 2/2] Add test for new when signature --- q/Q-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/q/Q-tests.ts b/q/Q-tests.ts index 48a3224bc..9dc49d979 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -94,6 +94,7 @@ Q.fbind((dateString?: string) => new Date(dateString), "11/11/1991")().then(d => Q.when(8, num => num + "!"); Q.when(Q(8), num => num + "!").then(str => str.split(',')); +var voidPromise: Q.Promise = Q.when(); declare function saveToDisk(): Q.Promise; declare function saveToCloud(): Q.Promise;