export class PromiseWrapper { public promise: Promise; public resolve: (result: T) => void; public reject: (reason) => void; then(onFulfilled, onRejected) { return this.promise.then(onFulfilled, onRejected); } constructor() { this.promise = new Promise( function(resolve, reject) { this.resolve = resolve; this.reject = reject; }.bind(this) ); } }