From b5353bd1b008ecfafe98cd6f0c2b5812b3cce515 Mon Sep 17 00:00:00 2001 From: Manu MA Date: Fri, 15 Nov 2019 17:31:15 +0100 Subject: [PATCH] fix(es5): workaround around es5 helpers name conflict (#2013) fixes #1916 --- src/compiler/transpile/transpile-to-es5-worker.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/transpile/transpile-to-es5-worker.ts b/src/compiler/transpile/transpile-to-es5-worker.ts index 53237ee24de..4876418835d 100644 --- a/src/compiler/transpile/transpile-to-es5-worker.ts +++ b/src/compiler/transpile/transpile-to-es5-worker.ts @@ -35,8 +35,14 @@ export async function transpileToEs5Worker(_cwd: string, input: string, inlineHe ); if (results.diagnostics.length === 0) { - results.code = tsResults.outputText; + results.code = fixHelpers(tsResults.outputText); } return results; } + +// TODO: +// remove once fixed: https://github.com/microsoft/TypeScript/issues/35108 +function fixHelpers(code: string) { + return code.replace(/\b__(extends|assign|rest|decorate|param|metadata|awaiter|generator|exportStar|values|read|spread|spreadArrays|await|asyncGenerator|asyncDelegator|asyncValues|makeTemplateObject|importStar|importDefault|)_\d\(/g, '__$1('); +}