@@ -927,7 +927,7 @@ declare module dojo {
927
927
*
928
928
*
929
929
*/
930
- class __Promise extends dojo.promise.Promise {
930
+ class __Promise implements dojo.promise.Promise<any> {
931
931
constructor();
932
932
/**
933
933
* A promise resolving to an object representing
@@ -988,19 +988,19 @@ declare module dojo {
988
988
* @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error.
989
989
* @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update.
990
990
*/
991
- then(callback?: Function, errback?: Function, progback?: Function): dojo.promise.Promise;
991
+ then(callback?: Function, errback?: Function, progback?: Function): dojo.promise.Promise<any> ;
992
992
/**
993
993
*
994
994
*/
995
995
toString(): String;
996
996
/**
997
997
*
998
998
*/
999
- trace(): dojo.promise.Promise;
999
+ trace(): dojo.promise.Promise<any> ;
1000
1000
/**
1001
1001
*
1002
1002
*/
1003
- traceRejected(): dojo.promise.Promise;
1003
+ traceRejected(): dojo.promise.Promise<any> ;
1004
1004
}
1005
1005
/**
1006
1006
* Permalink: http://dojotoolkit.org/api/1.9/dojo/request/default.html
@@ -1590,7 +1590,7 @@ declare module dojo {
1590
1590
* @param listener
1591
1591
* @param dontFix
1592
1592
*/
1593
- once(target: any, type: any, listener: any, dontFix: any): any;
1593
+ once(target: any, type: any, listener: any, dontFix? : any): any;
1594
1594
/**
1595
1595
*
1596
1596
* @param target
@@ -1783,7 +1783,7 @@ declare module dojo {
1783
1783
* @param errback OptionalCallback to be invoked when the promise is rejected.
1784
1784
* @param progback OptionalCallback to be invoked when the promise emits a progress update.
1785
1785
*/
1786
- interface when{(valueOrPromise: any , callback?: Function, errback?: Function , progback?: Function ): void }
1786
+ interface when { <T, U>(value: T|dojo.promise.Promise<T> , callback: dojo.promise.Callback<T, U>, errback?: any , progback?: any ): U|dojo.promise.Promise<U> }
1787
1787
/**
1788
1788
* Permalink: http://dojotoolkit.org/api/1.9/dojo/DeferredList.html
1789
1789
*
@@ -1822,7 +1822,7 @@ declare module dojo {
1822
1822
/**
1823
1823
*
1824
1824
*/
1825
- "promise": dojo.promise.Promise;
1825
+ "promise": dojo.promise.Promise<any> ;
1826
1826
/**
1827
1827
* Inform the deferred it may cancel its asynchronous operation.
1828
1828
* Inform the deferred it may cancel its asynchronous operation.
@@ -1863,7 +1863,7 @@ declare module dojo {
1863
1863
* @param update The progress update. Passed to progbacks.
1864
1864
* @param strict OptionalIf strict, will throw an error if the deferred has alreadybeen fulfilled and consequently no progress can be emitted.
1865
1865
*/
1866
- progress(update: any, strict: boolean): dojo.promise.Promise;
1866
+ progress(update: any, strict: boolean): dojo.promise.Promise<any> ;
1867
1867
/**
1868
1868
* Reject the deferred.
1869
1869
* Reject the deferred, putting it in an error state.
@@ -1879,7 +1879,7 @@ declare module dojo {
1879
1879
* @param value The result of the deferred. Passed to callbacks.
1880
1880
* @param strict OptionalIf strict, will throw an error if the deferred has alreadybeen fulfilled and consequently cannot be resolved.
1881
1881
*/
1882
- resolve(value: any, strict?: boolean): dojo.promise.Promise;
1882
+ resolve(value: any, strict?: boolean): dojo.promise.Promise<any> ;
1883
1883
/**
1884
1884
* Add new callbacks to the deferred.
1885
1885
* Add new callbacks to the deferred. Callbacks can be added
@@ -1889,7 +1889,7 @@ declare module dojo {
1889
1889
* @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error.
1890
1890
* @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update.
1891
1891
*/
1892
- then(callback: Function, errback: Function, progback: Function): dojo.promise.Promise;
1892
+ then(callback: Function, errback: Function, progback: Function): dojo.promise.Promise<any> ;
1893
1893
/**
1894
1894
*
1895
1895
*/
@@ -9119,7 +9119,7 @@ declare module dojo {
9119
9119
* @param errback OptionalCallback to be invoked when the promise is rejected.
9120
9120
* @param progback OptionalCallback to be invoked when the promise emits a progress update.
9121
9121
*/
9122
- when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise;
9122
+ when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise<any> ;
9123
9123
/**
9124
9124
* signal fired by impending window destruction. You may use
9125
9125
* dojo.addOnWIndowUnload() or dojo.connect() to this method to perform
@@ -16050,7 +16050,7 @@ declare module dojo {
16050
16050
*
16051
16051
* @param objectOrArray OptionalThe promise will be fulfilled with a list of results if invoked with anarray, or an object of results when passed an object (using the samekeys). If passed neither an object or array it is resolved with anundefined value.
16052
16052
*/
16053
- interface all{(objectOrArray?: Object ): void }
16053
+ interface all{<T>(value: Promise<T>[] ): Promise<T[]> }
16054
16054
/**
16055
16055
* Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/all.html
16056
16056
*
@@ -16063,7 +16063,7 @@ declare module dojo {
16063
16063
*
16064
16064
* @param objectOrArray OptionalThe promise will be fulfilled with a list of results if invoked with anarray, or an object of results when passed an object (using the samekeys). If passed neither an object or array it is resolved with anundefined value.
16065
16065
*/
16066
- interface all{(objectOrArray?: any[] ): void }
16066
+ interface all{(value: Object ): Promise<any> }
16067
16067
/**
16068
16068
* Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/first.html
16069
16069
*
@@ -16107,6 +16107,11 @@ declare module dojo {
16107
16107
* @param Deferred
16108
16108
*/
16109
16109
interface instrumentation{(Deferred: any): void}
16110
+
16111
+ interface Callback<T, U> {
16112
+ (arg: T): U|Promise<U>;
16113
+ }
16114
+
16110
16115
/**
16111
16116
* Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/Promise.html
16112
16117
*
@@ -16115,15 +16120,14 @@ declare module dojo {
16115
16120
* instances of this class.
16116
16121
*
16117
16122
*/
16118
- class Promise {
16119
- constructor();
16123
+ interface Promise<T> {
16120
16124
/**
16121
16125
* Add a callback to be invoked when the promise is resolved
16122
16126
* or rejected.
16123
16127
*
16124
16128
* @param callbackOrErrback OptionalA function that is used both as a callback and errback.
16125
16129
*/
16126
- always(callbackOrErrback: Function ): any ;
16130
+ always<U> (callbackOrErrback: Callback<any, U> ): Promise<U> ;
16127
16131
/**
16128
16132
* Inform the deferred it may cancel its asynchronous operation.
16129
16133
* Inform the deferred it may cancel its asynchronous operation.
@@ -16160,7 +16164,7 @@ declare module dojo {
16160
16164
*
16161
16165
* @param errback OptionalCallback to be invoked when the promise is rejected.
16162
16166
*/
16163
- otherwise(errback: Function ): any ;
16167
+ otherwise<U> (errback: Callback<any, U> ): Promise<U> ;
16164
16168
/**
16165
16169
* Add new callbacks to the promise.
16166
16170
* Add new callbacks to the deferred. Callbacks can be added
@@ -16170,7 +16174,7 @@ declare module dojo {
16170
16174
* @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error.
16171
16175
* @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update.
16172
16176
*/
16173
- then(callback: Function, errback?: Function, progback?: Function ): dojo.promise. Promise;
16177
+ then<U> (callback: Callback<T, U>, errback?: Callback<any, U>, progback?: Callback<any, U> ): Promise<U> ;
16174
16178
/**
16175
16179
*
16176
16180
*/
@@ -16184,7 +16188,7 @@ declare module dojo {
16184
16188
* to handle traces.
16185
16189
*
16186
16190
*/
16187
- trace(): dojo.promise. Promise;
16191
+ trace(): Promise<T> ;
16188
16192
/**
16189
16193
* Trace rejection of the promise.
16190
16194
* Tracing allows you to transparently log progress,
@@ -16194,7 +16198,7 @@ declare module dojo {
16194
16198
* to handle traces.
16195
16199
*
16196
16200
*/
16197
- traceRejected(): dojo.promise. Promise;
16201
+ traceRejected(): Promise<T> ;
16198
16202
}
16199
16203
/**
16200
16204
* Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/tracer.html
@@ -17467,7 +17471,7 @@ declare module dojo {
17467
17471
*
17468
17472
* @param results The result set as an array, or a promise for an array.
17469
17473
*/
17470
- interface QueryResults{(results: dojo.promise.Promise): void}
17474
+ interface QueryResults{(results: dojo.promise.Promise<any> ): void}
17471
17475
/**
17472
17476
* Permalink: http://dojotoolkit.org/api/1.9/dojo/store/util/SimpleQueryEngine.html
17473
17477
*
@@ -20456,7 +20460,7 @@ declare module dojo {
20456
20460
* @param value the number to be formatted
20457
20461
* @param options OptionalAn object with the following properties:pattern (String, optional): override formatting patternwith this string. Default value is based on locale. Overriding this property will defeatlocalization. Literal characters in patterns are not supported.type (String, optional): choose a format type based on the locale from the following:decimal, scientific (not yet supported), percent, currency. decimal by default.places (Number, optional): fixed number of decimal places to show. This overrides anyinformation in the provided pattern.round (Number, optional): 5 rounds to nearest .5; 0 rounds to nearest whole (default). -1means do not round.locale (String, optional): override the locale used to determine formatting rulesfractional (Boolean, optional): If false, show no decimal places, overriding places and pattern settings.
20458
20462
*/
20459
- format(value: number, options: Object): any;
20463
+ format(value: number, options? : Object): any;
20460
20464
/**
20461
20465
* Convert a properly formatted string to a primitive Number, using
20462
20466
* locale-specific settings.
@@ -20782,7 +20786,7 @@ declare module dojo {
20782
20786
* @param root OptionalA default starting root node from which to start the parsing. Can beomitted, defaulting to the entire document. If omitted, the optionsobject can be passed in this place. If the options object has arootNode member, that is used.
20783
20787
* @param options a kwArgs options object, see parse() for details
20784
20788
*/
20785
- scan(root: HTMLElement, options: Object): dojo.promise.Promise;
20789
+ scan(root: HTMLElement, options: Object): dojo.promise.Promise<any> ;
20786
20790
}
20787
20791
/**
20788
20792
* Permalink: http://dojotoolkit.org/api/1.9/dojo/regexp.html
@@ -24419,7 +24423,7 @@ declare module dojo {
24419
24423
* @param errback OptionalCallback to be invoked when the promise is rejected.
24420
24424
* @param progback OptionalCallback to be invoked when the promise emits a progress update.
24421
24425
*/
24422
- when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise;
24426
+ when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise<any> ;
24423
24427
/**
24424
24428
* signal fired by impending window destruction. You may use
24425
24429
* dojo.addOnWIndowUnload() or dojo.connect() to this method to perform
@@ -28268,8 +28272,8 @@ declare module "dojo/promise/tracer" {
28268
28272
export=exp;
28269
28273
}
28270
28274
declare module "dojo/promise/Promise" {
28271
- var exp: typeof dojo.promise.Promise
28272
- export=exp ;
28275
+ interface Promise<T> extends dojo.promise.Promise<T> { }
28276
+ export = Promise ;
28273
28277
}
28274
28278
declare module "dojo/rpc/JsonpService" {
28275
28279
var exp: typeof dojo.rpc.JsonpService
0 commit comments