From 31bd1a40437cd7bf1de437ba46e7b7bccbeefacd Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Sun, 6 Mar 2016 21:07:22 +0000 Subject: [PATCH] Fix __awaiter helper to be compatible with TS 1.8 --- src/typescript-helpers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/typescript-helpers.ts b/src/typescript-helpers.ts index 02f6d42..e0ad1c0 100644 --- a/src/typescript-helpers.ts +++ b/src/typescript-helpers.ts @@ -20,10 +20,10 @@ export function __param(paramIndex, decorator) { } export function __awaiter(thisArg, _arguments, P, generator) { - return new P(function (resolve, reject) { + return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.call(thisArg, _arguments)).next()); + step((generator = generator.apply(thisArg, _arguments)).next()); }); }