1// @target: es6 2// @strictNullChecks: true 3 4declare namespace Windows.Foundation { 5 interface IPromise<TResult> { 6 then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; 7 then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; 8 then<U>(success?: (value: TResult) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; 9 then<U>(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; 10 done<U>(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void; 11 12 cancel(): void; 13 } 14} 15 16async function sample(promise: Windows.Foundation.IPromise<number>) { 17 var number = await promise; 18} 19 20 21declare function resolve1<T>(value: T): Promise<T>; 22declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>; 23 24async function sample2(x?: number) { 25 let x1 = await resolve1(x); 26 let x2 = await resolve2(x); 27} 28