2016-05-03 23:51:30 +02:00
|
|
|
// @target: es6
|
|
|
|
// @strictNullChecks: true
|
|
|
|
|
|
|
|
declare namespace Windows.Foundation {
|
|
|
|
interface IPromise<TResult> {
|
|
|
|
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
|
|
|
then<U>(success?: (value: TResult) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
|
|
|
then<U>(success?: (value: TResult) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>;
|
|
|
|
then<U>(success?: (value: TResult) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>;
|
|
|
|
done<U>(success?: (value: TResult) => any, error?: (error: any) => any, progress?: (progress: any) => void): void;
|
|
|
|
|
|
|
|
cancel(): void;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function sample(promise: Windows.Foundation.IPromise<number>) {
|
|
|
|
var number = await promise;
|
|
|
|
}
|
2016-05-04 01:09:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
declare function resolve1<T>(value: T): Promise<T>;
|
|
|
|
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
|
|
|
|
|
|
|
|
async function sample2(x?: number) {
|
|
|
|
let x1 = await resolve1(x);
|
|
|
|
let x2 = await resolve2(x);
|
|
|
|
}
|