mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Added typings for when that afford promise type objects being passed in and mixes of different types.
This commit is contained in:
@@ -2296,7 +2296,8 @@ function test_EventIsCallable() {
|
||||
var ev = jQuery.Event('click');
|
||||
}
|
||||
|
||||
$.when(3, "asdf").then(x => x.asdf, x => x.length); // is type JQueryPromise<any>
|
||||
$.when($.ajax("/my/page.json")).then((a,b,c) => a.asdf); // is type JQueryPromise<any>
|
||||
$.when("asdf", "jkl;").done(x => x.length, x=> x.length);
|
||||
|
||||
var f1 = $.when("fetch"); // Is type JQueryPromise<string>
|
||||
var f2: JQueryPromise<string[]> = f1.then(s => [s, s]);
|
||||
|
||||
3
jquery/jquery.d.ts
vendored
3
jquery/jquery.d.ts
vendored
@@ -265,8 +265,9 @@ interface JQueryStatic {
|
||||
|
||||
noConflict(removeAll?: boolean): Object;
|
||||
|
||||
when<T>(...deferreds: JQueryGenericPromise<T>[]): JQueryPromise<T>;
|
||||
when<T>(...deferreds: T[]): JQueryPromise<T>;
|
||||
when(...deferreds: any[]): JQueryPromise<any>;
|
||||
when<T>(...deferreds: any[]): JQueryPromise<T>;
|
||||
|
||||
// CSS
|
||||
css(e: any, propertyName: string, value?: any);
|
||||
|
||||
Reference in New Issue
Block a user