/// /// /// /// /// var thenNum: PromisesAPlus.Thenable; var thenStr: PromisesAPlus.Thenable; var thenBool: PromisesAPlus.Thenable; var impl: PromisesAPlus.PromiseImpl; declare class PromiseImpl { constructor(resolver: (resolvePromise: (value: R) => void, rejectPromise: (reason: any) => void) => void); then(onFulfill: (value: R) => PromiseImpl, onReject: (error: any) => PromiseImpl): PromiseImpl; then(onFulfill: (value: R) => PromiseImpl, onReject?: (error: any) => U): PromiseImpl; then(onFulfill: (value: R) => U, onReject: (error: any) => PromiseImpl): PromiseImpl; then(onFulfill?: (value: R) => U, onReject?: (error: any) => U): PromiseImpl; } function testCompatibleWithPromiseImpl() { var pNum: PromiseImpl = thenNum; thenNum = pNum; impl = PromiseImpl; } function testCompatibleWithRxJS() { // from spec to Rx var rxThenNum: Rx.IPromise = thenNum; var rxThenStr: Rx.IPromise = thenStr; // from Rx to spec thenNum = rxThenNum; thenStr = rxThenStr; var obsNum: Rx.Observable; // implementation usage thenNum = obsNum.toPromise>(impl); thenNum = obsNum.toPromise(impl); obsNum.toPromise(PromiseImpl); } function testCompatibleWithES6Promises() { // from spec to ES6 var es6ThenNum: Thenable = thenNum; var es6ThenStr: Thenable = thenStr; // from ES6 to spec thenNum = es6ThenNum; thenStr = es6ThenStr; // implementation impl = Promise; } function testCompatibleWithQ() { // from spec to ES6 var qThenNum: Q.IPromise = thenNum; var qThenStr: Q.IPromise = thenStr; // from ES6 to spec thenNum = qThenNum; thenStr = qThenStr; // there's no standart implementation with constructor behaviour } function testCompatibleWithWhen() { var whenPromiseNum: When.Promise; var whenPromiseStr: When.Promise; // from ES6 to spec thenNum = whenPromiseNum; thenStr = whenPromiseStr; // there's no standart implementation with constructor behaviour }