From 9014c6fb941d9f63d452e58058f6ef97fcf9ba25 Mon Sep 17 00:00:00 2001 From: johnnyreilly Date: Sat, 21 Dec 2013 15:47:34 +0000 Subject: [PATCH 1/4] Q: change overload order fixes tests --- q/Q.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/q/Q.d.ts b/q/Q.d.ts index 31537423f..4d7a7ce4f 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -106,14 +106,14 @@ declare module Q { export function nsend(nodeModule: any, functionName: string, ...args: any[]): Promise; export function nmcall(nodeModule: any, functionName: string, ...args: any[]): Promise; - export function all(promises: any[]): Promise; export function all(promises: IPromise[]): Promise; + export function all(promises: any[]): Promise; - export function allSettled(promises: any[]): Promise[]>; export function allSettled(promises: IPromise[]): Promise[]>; + export function allSettled(promises: any[]): Promise[]>; - export function allResolved(promises: any[]): Promise[]>; export function allResolved(promises: IPromise[]): Promise[]>; + export function allResolved(promises: any[]): Promise[]>; export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected: (reason: any) => IPromise): Promise; export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected: (reason: any) => U): Promise; From 6ab78313068a88b3badefe301a6d7b59aa28ec0c Mon Sep 17 00:00:00 2001 From: johnnyreilly Date: Mon, 23 Dec 2013 09:54:50 +0000 Subject: [PATCH 2/4] Q: Fixed up test with help from @IgorBek --- q/Q-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/q/Q-tests.ts b/q/Q-tests.ts index 21fc95138..22f33506e 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -23,7 +23,7 @@ Q.delay(8, 1000).then(x => x.toExponential()); Q.delay(Q("asdf"), 1000).then(x => x.length); Q.delay("asdf", 1000).then(x => x.length); -var eventualAdd = Q.promised((a: number, b: number) => a + b); +var eventualAdd = Q.promised((a?: number, b?: number) => a + b); eventualAdd(Q(1), Q(2)).then(x => x.toExponential()); var eventually = function (eventually) { @@ -90,7 +90,7 @@ Q.all(promiseArray).then(nums => nums.map(num => num.toPrecision(2)).join(',')); Q.all(myNums).then(nums => nums.map(Math.round)); -Q.fbind((dateString) => new Date(dateString), "11/11/1991")().then(d => d.toLocaleDateString()); +Q.fbind((dateString?: string) => new Date(dateString), "11/11/1991")().then(d => d.toLocaleDateString()); Q.when(8, num => num + "!"); Q.when(Q(8), num => num + "!").then(str => str.split(',')); From 9675d3a1e04771ebc6ba2323905db07e97e6a0d9 Mon Sep 17 00:00:00 2001 From: johnnyreilly Date: Mon, 23 Dec 2013 10:08:37 +0000 Subject: [PATCH 3/4] jQuery: Fix test --- jquery/jquery-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 0a935ce44..8ea41f2c1 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -2372,7 +2372,7 @@ function test_EventIsCallable() { var ev = jQuery.Event('click'); } -$.when($.ajax("/my/page.json")).then((a,b,c) => a.asdf); // is type JQueryPromise +$.when($.ajax("/my/page.json")).then((a?,b?,c?) => a.asdf); // is type JQueryPromise $.when("asdf", "jkl;").done((x,y) => x.length + y.length, (x,y) => x.length + y.length); var f1 = $.when("fetch"); // Is type JQueryPromise From 15e43db83a8119e2ef8464fa02e5683d2589f0c6 Mon Sep 17 00:00:00 2001 From: johnnyreilly Date: Mon, 23 Dec 2013 10:17:28 +0000 Subject: [PATCH 4/4] jQuery.validation: Fix tests --- jquery.validation/jquery.validation-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.validation/jquery.validation-tests.ts b/jquery.validation/jquery.validation-tests.ts index b8f7a16ae..0096db974 100644 --- a/jquery.validation/jquery.validation-tests.ts +++ b/jquery.validation/jquery.validation-tests.ts @@ -140,12 +140,12 @@ function test_validate() { } }); $(".selector").validate({ - highlight: function (element, errorClass, validClass) { + highlight: function (element: HTMLInputElement, errorClass, validClass) { $(element).addClass(errorClass).removeClass(validClass); $(element.form).find("label[for=" + element.id + "]") .addClass(errorClass); }, - unhighlight: function (element, errorClass, validClass) { + unhighlight: function (element: HTMLInputElement, errorClass, validClass) { $(element).removeClass(errorClass).addClass(validClass); $(element.form).find("label[for=" + element.id + "]") .removeClass(errorClass);