From fa6f389191ae5c08012efbe47b26be004abea3f1 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Tue, 26 Nov 2013 17:39:54 +0000 Subject: [PATCH 1/2] Q:jQueryPromise converted implicitly to Q promise --- q/Q.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/q/Q.d.ts b/q/Q.d.ts index e56d5cc17..31537423f 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -3,8 +3,11 @@ // Definitions by: Barrie Nemetchek, Andrew Gaspar // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare function Q(value: T): Q.Promise; +/// + declare function Q(promise: Q.IPromise): Q.Promise; +declare function Q(promise: JQueryPromise): Q.Promise; +declare function Q(value: T): Q.Promise; declare module Q { interface IPromise { From d0c2d93cc0fe0498308fbab3f3e6efa7f706df1b Mon Sep 17 00:00:00 2001 From: John Reilly Date: Tue, 26 Nov 2013 17:48:45 +0000 Subject: [PATCH 2/2] Q: updated test to reflect --- q/Q-tests.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/q/Q-tests.ts b/q/Q-tests.ts index 3407259ca..21fc95138 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -79,6 +79,9 @@ declare var jPromise: JQueryPromise; Q(jPromise).then(str => str.split(',')); jPromise.then(returnsNumPromise); +// watch the typing flow through from jQueryPromise to Q.Promise +Q(jPromise).then(str => str.split(',')); + declare var promiseArray: Q.IPromise[]; var qPromiseArray = promiseArray.map(p => Q(p)); var myNums: any[] = [2, 3, Q(4), 5, Q(6), Q(7)];