diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 01f75a9855..4fb31f0ed2 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -2294,4 +2294,11 @@ function test_EventIsNewable() { function test_EventIsCallable() { var ev = jQuery.Event('click'); -} \ No newline at end of file +} + +$.when($.ajax("/my/page.json")).then((a,b,c) => a.asdf); // is type JQueryPromise +$.when("asdf", "jkl;").done(x => x.length, x=> x.length); + +var f1 = $.when("fetch"); // Is type JQueryPromise +var f2: JQueryPromise = f1.then(s => [s, s]); +var f3: JQueryPromise = f2.then(v => 3); diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index c2f9f47ddb..57dfff6be4 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -105,11 +105,11 @@ interface JQueryPromise { then(onFulfill: (value: T) => U, onReject?: (...reasons) => JQueryGenericPromise, onProgress?: (...progression) => any): JQueryPromise; then(onFulfill: (value: T) => JQueryGenericPromise, onReject?: (...reasons) => JQueryGenericPromise, onProgress?: (...progression) => any): JQueryPromise; - /* Because JQuery Promises Suck */ - then(onFulfill: (...args) => U, onReject?: (...reasons) => U, onProgress?: (...progression) => any): JQueryPromise; - then(onFulfill: (...args) => JQueryGenericPromise, onReject?: (...reasons) => U, onProgress?: (...progression) => any): JQueryPromise; - then(onFulfill: (...args) => U, onReject?: (...reasons) => JQueryGenericPromise, onProgress?: (...progression) => any): JQueryPromise; - then(onFulfill: (...args) => JQueryGenericPromise, onReject?: (...reasons) => JQueryGenericPromise, onProgress?: (...progression) => any): JQueryPromise; + // Because JQuery Promises Suck + then(onFulfill: (...values) => U, onReject?: (...reasons) => U, onProgress?: (...progression) => any): JQueryPromise; + then(onFulfill: (...values) => JQueryGenericPromise, onReject?: (...reasons) => U, onProgress?: (...progression) => any): JQueryPromise; + then(onFulfill: (...values) => U, onReject?: (...reasons) => JQueryGenericPromise, onProgress?: (...progression) => any): JQueryPromise; + then(onFulfill: (...values) => JQueryGenericPromise, onReject?: (...reasons) => JQueryGenericPromise, onProgress?: (...progression) => any): JQueryPromise; } /* @@ -265,7 +265,9 @@ interface JQueryStatic { noConflict(removeAll?: boolean): Object; - when(...deferreds: any[]): JQueryPromise; + when(...deferreds: JQueryGenericPromise[]): JQueryPromise; + when(...deferreds: T[]): JQueryPromise; + when(...deferreds: any[]): JQueryPromise; // CSS css(e: any, propertyName: string, value?: any); diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 572edbc71f..50fb3fcc47 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -12,27 +12,27 @@ declare var describe : { declare var it: { (expectation: string, assertion?: () => void): void; - (expectation: string, assertion?: (done: () => void) => void): void; + (expectation: string, assertion?: (done: (failReason?) => void) => void): void; only(expectation: string, assertion?: () => void): void; - only(expectation: string, assertion?: (done: () => void) => void): void; + only(expectation: string, assertion?: (done: (failReason?) => void) => void): void; skip(expectation: string, assertion?: () => void): void; - skip(expectation: string, assertion?: (done: () => void) => void): void; + skip(expectation: string, assertion?: (done: (failReason?) => void) => void): void; timeout(ms: number); }; declare function before(action: () => void): void; -declare function before(action: (done: () => void) => void): void; +declare function before(action: (done: (failReason?) => void) => void): void; declare function after(action: () => void): void; -declare function after(action: (done: () => void) => void): void; +declare function after(action: (done: (failReason?) => void) => void): void; declare function beforeEach(action: () => void): void; -declare function beforeEach(action: (done: () => void) => void): void; +declare function beforeEach(action: (done: (failReason?) => void) => void): void; declare function afterEach(action: () => void): void; -declare function afterEach(action: (done: () => void) => void): void; +declare function afterEach(action: (done: (failReason?) => void) => void): void;