1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
|
=== tests/cases/compiler/variableDeclaratorResolvedDuringContextualTyping.ts ===
module WinJS {
>WinJS : typeof WinJS
export interface ValueCallback {
(value: any): any;
>value : any
}
export interface EventCallback {
(value: any): void;
>value : any
}
export interface ErrorCallback {
(error: any): any;
>error : any
}
export interface ProgressCallback {
(progress: any): any;
>progress : any
}
export declare class Promise {
>Promise : Promise
constructor(init: (complete: ValueCallback, error: ErrorCallback, progress: ProgressCallback) => void, oncancel?: any);
>init : (complete: ValueCallback, error: ErrorCallback, progress: ProgressCallback) => void
>complete : ValueCallback
>error : ErrorCallback
>progress : ProgressCallback
>oncancel : any
static as(value: any): Promise;
>as : (value: any) => Promise
>value : any
static join(promises: { [name: string]: Promise; }): Promise;
>join : { (promises: { [name: string]: Promise; }): Promise; (promises: Promise[]): Promise; }
>promises : { [name: string]: Promise; }
>name : string
static join(promises: Promise[]): Promise;
>join : { (promises: { [name: string]: Promise; }): Promise; (promises: Promise[]): Promise; }
>promises : Promise[]
static any(promises: Promise[]): Promise;
>any : (promises: Promise[]) => Promise
>promises : Promise[]
static timeout(delay: number): Promise;
>timeout : (delay: number) => Promise
>delay : number
static wrapError(error: any): Promise;
>wrapError : (error: any) => Promise
>error : any
static is(value: any): boolean;
>is : (value: any) => boolean
>value : any
static addEventListener(type: string, fn: EventCallback);
>addEventListener : (type: string, fn: EventCallback) => any
>type : string
>fn : EventCallback
public then(success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback): Promise;
>then : (success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback) => Promise
>success : ValueCallback
>error : ErrorCallback
>progress : ProgressCallback
public done(success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback): void;
>done : (success?: ValueCallback, error?: ErrorCallback, progress?: ProgressCallback) => void
>success : ValueCallback
>error : ErrorCallback
>progress : ProgressCallback
public cancel(): void;
>cancel : () => void
}
export declare class TPromise<V> {
>TPromise : TPromise<V>
constructor(init: (complete: (value: V) => void, error: (err: any) => void, progress: ProgressCallback) => void, oncancel?: any);
>init : (complete: (value: V) => void, error: (err: any) => void, progress: ProgressCallback) => void
>complete : (value: V) => void
>value : V
>error : (err: any) => void
>err : any
>progress : ProgressCallback
>oncancel : any
public then<U>(success?: (value: V) => TPromise<U>, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>;
>then : { <U>(success?: (value: V) => TPromise<U>, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => TPromise<U>, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => U, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>; }
>success : (value: V) => TPromise<U>
>value : V
>error : (err: any) => TPromise<U>
>err : any
>progress : ProgressCallback
public then<U>(success?: (value: V) => TPromise<U>, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>;
>then : { <U>(success?: (value: V) => TPromise<U>, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => TPromise<U>, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => U, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>; }
>success : (value: V) => TPromise<U>
>value : V
>error : (err: any) => U
>err : any
>progress : ProgressCallback
public then<U>(success?: (value: V) => U, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>;
>then : { <U>(success?: (value: V) => TPromise<U>, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => TPromise<U>, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => U, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>; }
>success : (value: V) => U
>value : V
>error : (err: any) => TPromise<U>
>err : any
>progress : ProgressCallback
public then<U>(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>;
>then : { <U>(success?: (value: V) => TPromise<U>, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => TPromise<U>, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => U, error?: (err: any) => TPromise<U>, progress?: ProgressCallback): TPromise<U>; <U>(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): TPromise<U>; }
>success : (value: V) => U
>value : V
>error : (err: any) => U
>err : any
>progress : ProgressCallback
public done(success?: (value: V) => void, error?: (err: any) => any, progress?: ProgressCallback): void;
>done : (success?: (value: V) => void, error?: (err: any) => any, progress?: ProgressCallback) => void
>success : (value: V) => void
>value : V
>error : (err: any) => any
>err : any
>progress : ProgressCallback
public cancel(): void;
>cancel : () => void
public static as<ValueType>(value: ValueType): TPromise<ValueType>;
>as : <ValueType>(value: ValueType) => TPromise<ValueType>
>value : ValueType
public static timeout(delay: number): TPromise<void>;
>timeout : (delay: number) => TPromise<void>
>delay : number
public static join<ValueType>(promises: TPromise<ValueType>[]): TPromise<ValueType[]>;
>join : <ValueType>(promises: TPromise<ValueType>[]) => TPromise<ValueType[]>
>promises : TPromise<ValueType>[]
public static any<ValueType>(promises: TPromise<ValueType>[]): TPromise<ValueType>;
>any : <ValueType>(promises: TPromise<ValueType>[]) => TPromise<ValueType>
>promises : TPromise<ValueType>[]
public static wrapError<ValueType>(error: any): TPromise<ValueType>;
>wrapError : <ValueType>(error: any) => TPromise<ValueType>
>error : any
}
export interface IXHROptions {
type?: string;
>type : string
url?: string;
>url : string
user?: string;
>user : string
password?: string;
>password : string
responseType?: string;
>responseType : string
headers?: any;
>headers : any
customRequestInitializer?: (req: any) => void;
>customRequestInitializer : (req: any) => void
>req : any
data?: any;
>data : any
}
}
module Services {
export interface IRequestService {
/**
* Returns the URL that can be used to access the provided service. The optional second argument can
* be provided to narrow down the request URL to a specific file system resource. The third argument
* allows to specify to return a fully absolute server URL.
*/
getRequestUrl(service: string, path?: string): string;
>getRequestUrl : { (service: string, path?: string): string; (service: string, path?: string, absolute?: boolean): string; }
>service : string
>path : string
getRequestUrl(service: string, path?: string, absolute?: boolean): string;
>getRequestUrl : { (service: string, path?: string): string; (service: string, path?: string, absolute?: boolean): string; }
>service : string
>path : string
>absolute : boolean
/**
* Wraps the call into WinJS.XHR to allow for mocking and telemetry. Use this instead
* of calling WinJS.XHR directly.
*/
makeRequest(options: WinJS.IXHROptions): WinJS.Promise;
>makeRequest : (options: WinJS.IXHROptions) => WinJS.Promise
>options : WinJS.IXHROptions
>WinJS : any
>WinJS : any
}
}
module Errors {
>Errors : typeof Errors
export class ConnectionError /* extends Error */ {
>ConnectionError : ConnectionError
constructor(request: XMLHttpRequest) {
>request : XMLHttpRequest
}
}
}
module Files {
export interface IUploadResult {
stat: string;
>stat : string
isNew: boolean;
>isNew : boolean
}
}
interface XMLHttpRequest {
status: number;
>status : number
responseText: string;
>responseText : string
statusText: string;
>statusText : string
}
class FileService {
>FileService : FileService
private requestService: Services.IRequestService;
>requestService : Services.IRequestService
>Services : any
public uploadData(): WinJS.TPromise<Files.IUploadResult> {
>uploadData : () => WinJS.TPromise<Files.IUploadResult>
>WinJS : any
>Files : any
var path = "";
>path : string
>"" : ""
return this.requestService.makeRequest({
>this.requestService.makeRequest({ url: this.requestService.getRequestUrl('root', path), type: 'POST', headers: {}, data: "someData" }).then((response: XMLHttpRequest) => { var result: IUploadResult = { // This should be error stat: this.jsonToStat(newFilePath, "someString"), // _this needs to be emitted to the js file isNew: response.status === 201 }; return WinJS.TPromise.as<Files.IUploadResult>(result); }, (xhr: XMLHttpRequest) => { return WinJS.Promise.wrapError(new Errors.ConnectionError(xhr)); }) : WinJS.Promise
>this.requestService.makeRequest({ url: this.requestService.getRequestUrl('root', path), type: 'POST', headers: {}, data: "someData" }).then : (success?: WinJS.ValueCallback, error?: WinJS.ErrorCallback, progress?: WinJS.ProgressCallback) => WinJS.Promise
>this.requestService.makeRequest({ url: this.requestService.getRequestUrl('root', path), type: 'POST', headers: {}, data: "someData" }) : WinJS.Promise
>this.requestService.makeRequest : (options: WinJS.IXHROptions) => WinJS.Promise
>this.requestService : Services.IRequestService
>this : this
>requestService : Services.IRequestService
>makeRequest : (options: WinJS.IXHROptions) => WinJS.Promise
>{ url: this.requestService.getRequestUrl('root', path), type: 'POST', headers: {}, data: "someData" } : { url: string; type: string; headers: {}; data: string; }
url: this.requestService.getRequestUrl('root', path),
>url : string
>this.requestService.getRequestUrl('root', path) : string
>this.requestService.getRequestUrl : { (service: string, path?: string): string; (service: string, path?: string, absolute?: boolean): string; }
>this.requestService : Services.IRequestService
>this : this
>requestService : Services.IRequestService
>getRequestUrl : { (service: string, path?: string): string; (service: string, path?: string, absolute?: boolean): string; }
>'root' : "root"
>path : string
type: 'POST',
>type : string
>'POST' : "POST"
headers: {},
>headers : {}
>{} : {}
data: "someData"
>data : string
>"someData" : "someData"
}).then((response: XMLHttpRequest) => {
>then : (success?: WinJS.ValueCallback, error?: WinJS.ErrorCallback, progress?: WinJS.ProgressCallback) => WinJS.Promise
>(response: XMLHttpRequest) => { var result: IUploadResult = { // This should be error stat: this.jsonToStat(newFilePath, "someString"), // _this needs to be emitted to the js file isNew: response.status === 201 }; return WinJS.TPromise.as<Files.IUploadResult>(result); } : (response: XMLHttpRequest) => WinJS.TPromise<Files.IUploadResult>
>response : XMLHttpRequest
var result: IUploadResult = { // This should be error
>result : IUploadResult
>{ // This should be error stat: this.jsonToStat(newFilePath, "someString"), // _this needs to be emitted to the js file isNew: response.status === 201 } : { stat: any; isNew: boolean; }
stat: this.jsonToStat(newFilePath, "someString"), // _this needs to be emitted to the js file
>stat : any
>this.jsonToStat(newFilePath, "someString") : any
>this.jsonToStat : any
>this : this
>jsonToStat : any
>newFilePath : any
>"someString" : "someString"
isNew: response.status === 201
>isNew : boolean
>response.status === 201 : boolean
>response.status : number
>response : XMLHttpRequest
>status : number
>201 : 201
};
return WinJS.TPromise.as<Files.IUploadResult>(result);
>WinJS.TPromise.as<Files.IUploadResult>(result) : WinJS.TPromise<Files.IUploadResult>
>WinJS.TPromise.as : <ValueType>(value: ValueType) => WinJS.TPromise<ValueType>
>WinJS.TPromise : typeof WinJS.TPromise
>WinJS : typeof WinJS
>TPromise : typeof WinJS.TPromise
>as : <ValueType>(value: ValueType) => WinJS.TPromise<ValueType>
>Files : any
>result : IUploadResult
}, (xhr: XMLHttpRequest) => {
>(xhr: XMLHttpRequest) => { return WinJS.Promise.wrapError(new Errors.ConnectionError(xhr)); } : (xhr: XMLHttpRequest) => WinJS.Promise
>xhr : XMLHttpRequest
return WinJS.Promise.wrapError(new Errors.ConnectionError(xhr));
>WinJS.Promise.wrapError(new Errors.ConnectionError(xhr)) : WinJS.Promise
>WinJS.Promise.wrapError : (error: any) => WinJS.Promise
>WinJS.Promise : typeof WinJS.Promise
>WinJS : typeof WinJS
>Promise : typeof WinJS.Promise
>wrapError : (error: any) => WinJS.Promise
>new Errors.ConnectionError(xhr) : Errors.ConnectionError
>Errors.ConnectionError : typeof Errors.ConnectionError
>Errors : typeof Errors
>ConnectionError : typeof Errors.ConnectionError
>xhr : XMLHttpRequest
});
}
}
|