diff --git a/q/Q-tests.ts b/q/Q-tests.ts index 025a92358..ab613f8aa 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -16,6 +16,10 @@ Q.when(delay(1000), function (val: void) { return; }); +// Note from Q documentation: a deferred can be resolved with a value or a promise. +var otherPromise = Q.defer().promise; +Q.defer().resolve(otherPromise); + Q.timeout(Q(new Date()), 1000, "My dates never arrived. :(").then(d => d.toJSON()); Q.delay(Q(8), 1000).then(x => x.toExponential()); diff --git a/q/Q.d.ts b/q/Q.d.ts index c38e529cf..bd9cdb8ca 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -21,6 +21,7 @@ declare namespace Q { interface Deferred { promise: Promise; resolve(value?: T): void; + resolve(value?: IPromise): void; reject(reason: any): void; notify(value: any): void; makeNodeResolver(): (reason: any, value: T) => void;