From bbd556ee9ff1f6f1445cf5b94311211e3dc56dd7 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 12 May 2020 14:28:20 +0200 Subject: [PATCH] test: enable importHelpers for UMD builds (#36989) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a workaround for a TS 3.9 regression https://github.com/microsoft/TypeScript/issues/38501 where the emitted `__exportStar` helpers have a missing semi-colon at the end of the unnamed function, when targetting UMD, and causes the following runtime error `Uncaught TypeError: (intermediate value)(…) is not a function`. This is because the anonymous `__exportStar` function will be invoked with the function on the next like as the parameter which is subsequently invoking whatever was returned. To get around this TS bug, add `importHelpers: true` in your tsconfig. This also, is recommanded to avoid multiple copies of the same helper being inlined, which might cause increase in bundle size. PR Close #36989 --- integration/bazel/src/tsconfig.json | 1 + packages/examples/upgrade/tsconfig-build.json | 1 + 2 files changed, 2 insertions(+) diff --git a/integration/bazel/src/tsconfig.json b/integration/bazel/src/tsconfig.json index 068cd10fcc..c568afaad1 100644 --- a/integration/bazel/src/tsconfig.json +++ b/integration/bazel/src/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "importHelpers": true, "experimentalDecorators": true, "lib": [ "dom", diff --git a/packages/examples/upgrade/tsconfig-build.json b/packages/examples/upgrade/tsconfig-build.json index 70ccf09202..eb79d48482 100644 --- a/packages/examples/upgrade/tsconfig-build.json +++ b/packages/examples/upgrade/tsconfig-build.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "importHelpers": true, "lib": ["dom", "es2015"], "types": ["angular"] }