From ef853367194c77f505a0705e45f5670725873da1 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Mon, 18 Mar 2019 14:44:56 +0000 Subject: [PATCH] build: update to TypeScript 3.4 (#29372) PR Close #29372 --- aio/package.json | 2 +- aio/src/app/shared/reporting-error-handler.ts | 10 ++++++---- aio/tests/e2e/onerror.e2e-spec.ts | 4 +++- aio/yarn.lock | 8 ++++---- integration/bazel-schematics/test.sh | 2 +- integration/bazel/src/package.json | 2 +- integration/dynamic-compiler/package.json | 3 ++- .../include-all.ts | 0 .../package.json | 4 ++-- .../tsconfig.json | 0 package.json | 2 +- packages/bazel/package.json | 2 +- packages/compiler-cli/ngcc/src/rendering/renderer.ts | 2 +- packages/compiler-cli/package.json | 4 ++-- packages/compiler-cli/src/transformers/program.ts | 4 ++-- tools/ts-api-guardian/package.json | 6 +++--- yarn.lock | 8 ++++---- 17 files changed, 34 insertions(+), 29 deletions(-) rename integration/{typings_test_ts33 => typings_test_ts34}/include-all.ts (100%) rename integration/{typings_test_ts33 => typings_test_ts34}/package.json (98%) rename integration/{typings_test_ts33 => typings_test_ts34}/tsconfig.json (100%) diff --git a/aio/package.json b/aio/package.json index accf88126f..8caae64dee 100644 --- a/aio/package.json +++ b/aio/package.json @@ -157,7 +157,7 @@ "ts-node": "^3.3.0", "tslib": "^1.9.0", "tslint": "~5.9.1", - "typescript": "~3.3.3333", + "typescript": "~3.4.2", "uglify-js": "^3.0.15", "unist-util-filter": "^0.2.1", "unist-util-source": "^1.0.1", diff --git a/aio/src/app/shared/reporting-error-handler.ts b/aio/src/app/shared/reporting-error-handler.ts index 6289d6e057..126580f157 100644 --- a/aio/src/app/shared/reporting-error-handler.ts +++ b/aio/src/app/shared/reporting-error-handler.ts @@ -28,10 +28,12 @@ export class ReportingErrorHandler extends ErrorHandler { } private reportError(error: string | Error) { - if (typeof error === 'string') { - this.window.onerror(error); - } else { - this.window.onerror(error.message, undefined, undefined, undefined, error); + if (this.window.onerror) { + if (typeof error === 'string') { + this.window.onerror(error); + } else { + this.window.onerror(error.message, undefined, undefined, undefined, error); + } } } } diff --git a/aio/tests/e2e/onerror.e2e-spec.ts b/aio/tests/e2e/onerror.e2e-spec.ts index 70549b4cd0..733681bea6 100644 --- a/aio/tests/e2e/onerror.e2e-spec.ts +++ b/aio/tests/e2e/onerror.e2e-spec.ts @@ -190,7 +190,9 @@ createViewNodes@???`); // reset the ga queue (window as any).ga.q.length = 0; // post the error to the handler - window.onerror(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); + if (window.onerror) { + window.onerror(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); + } }, message, url, line, column, error); const gaCalls = await page.ga(); const exceptionCall = gaCalls.find(call => call[0] === 'send' && call[1] === 'exception'); diff --git a/aio/yarn.lock b/aio/yarn.lock index 3d8116aae8..5911119058 100644 --- a/aio/yarn.lock +++ b/aio/yarn.lock @@ -10576,10 +10576,10 @@ typescript@^2.4.1: version "2.6.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" -typescript@^3.2.2, typescript@~3.3.3333: - version "3.3.3333" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6" - integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw== +typescript@^3.2.2, typescript@~3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.2.tgz#9ed4e6475d906f589200193be056f5913caed481" + integrity sha512-Og2Vn6Mk7JAuWA1hQdDQN/Ekm/SchX80VzLhjKN9ETYrIepBFAd8PkOdOTK2nKt0FCkmMZKBJvQ1dV1gIxPu/A== uglify-js@^3.0.15, uglify-js@^3.1.4: version "3.4.9" diff --git a/integration/bazel-schematics/test.sh b/integration/bazel-schematics/test.sh index 4d1c577f59..0b55efbe34 100755 --- a/integration/bazel-schematics/test.sh +++ b/integration/bazel-schematics/test.sh @@ -30,7 +30,7 @@ function testBazel() { yarn # Force more recent TS version until new Angular CLI projects also use it. # --ignore-scripts is necessary because there is a postinstall script that uses ngc. - yarn add typescript@3.3.3333 --dev --ignore-scripts + yarn add typescript@3.4.2 --dev --ignore-scripts installLocalPackages yarn webdriver-manager update --gecko=false --standalone=false ${CI_CHROMEDRIVER_VERSION_ARG:---versions.chrome 2.45} ng generate component widget --style=css diff --git a/integration/bazel/src/package.json b/integration/bazel/src/package.json index 617fe7cac5..4877883502 100644 --- a/integration/bazel/src/package.json +++ b/integration/bazel/src/package.json @@ -24,7 +24,7 @@ "@types/jasmine": "2.8.8", "@types/source-map": "0.5.1", "protractor": "5.1.2", - "typescript": "3.3.3333" + "typescript": "3.4.2" }, "scripts": { "postinstall": "ngc -p ./angular-metadata.tsconfig.json", diff --git a/integration/dynamic-compiler/package.json b/integration/dynamic-compiler/package.json index 3031bf2f21..bfb1c8c756 100644 --- a/integration/dynamic-compiler/package.json +++ b/integration/dynamic-compiler/package.json @@ -5,7 +5,8 @@ "scripts": { "build": "npm run clean && npm run ngc && npm run rollup && npm run rollup:lazy && npm run es5 && npm run es5:lazy", "clean": "rm -rf dist", - "es5": "tsc --target es5 --skipLibCheck --allowJs dist/bundle.es2015.js --out dist/bundle.js", + "//es5-note": "`--typeRoots ./dummy_folder_name/@types` is a workaround for https://github.com/Microsoft/TypeScript/issues/30845", + "es5": "tsc --target es5 --skipLibCheck --allowJs dist/bundle.es2015.js --out dist/bundle.js --typeRoots ./dummy_folder_name/@types", "es5:lazy": "tsc --target es5 --skipLibCheck --allowJs dist/lazy.bundle.es2015.js --out dist/lazy.bundle.js", "ngc": "ngc -p tsconfig.json", "rollup": "rollup -f iife -c rollup.config.js -o dist/bundle.es2015.js", diff --git a/integration/typings_test_ts33/include-all.ts b/integration/typings_test_ts34/include-all.ts similarity index 100% rename from integration/typings_test_ts33/include-all.ts rename to integration/typings_test_ts34/include-all.ts diff --git a/integration/typings_test_ts33/package.json b/integration/typings_test_ts34/package.json similarity index 98% rename from integration/typings_test_ts33/package.json rename to integration/typings_test_ts34/package.json index bb7c2b41e3..5086dacdcf 100644 --- a/integration/typings_test_ts33/package.json +++ b/integration/typings_test_ts34/package.json @@ -21,10 +21,10 @@ "@angular/upgrade": "file:../../dist/packages-dist/upgrade", "@types/jasmine": "2.5.41", "rxjs": "file:../../node_modules/rxjs", - "typescript": "3.3.x", + "typescript": "3.4.2", "zone.js": "file:../../node_modules/zone.js" }, "scripts": { "test": "tsc" } -} \ No newline at end of file +} diff --git a/integration/typings_test_ts33/tsconfig.json b/integration/typings_test_ts34/tsconfig.json similarity index 100% rename from integration/typings_test_ts33/tsconfig.json rename to integration/typings_test_ts34/tsconfig.json diff --git a/package.json b/package.json index 2e7997edd6..399183a107 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "tsickle": "0.34.3", "tslib": "^1.9.0", "tslint": "5.7.0", - "typescript": "~3.3.3333", + "typescript": "~3.4.2", "xhr2": "0.1.4", "yargs": "9.0.1", "zone.js": "^0.9.0" diff --git a/packages/bazel/package.json b/packages/bazel/package.json index dc59975e72..b6a2280205 100644 --- a/packages/bazel/package.json +++ b/packages/bazel/package.json @@ -39,7 +39,7 @@ "peerDependencies": { "@angular/compiler-cli": "0.0.0-PLACEHOLDER", "@bazel/typescript": "0.27.10", - "typescript": ">=3.3.3333 <3.4" + "typescript": ">=3.4 <3.5" }, "repository": { "type": "git", diff --git a/packages/compiler-cli/ngcc/src/rendering/renderer.ts b/packages/compiler-cli/ngcc/src/rendering/renderer.ts index 639606bfb7..172a2abe55 100644 --- a/packages/compiler-cli/ngcc/src/rendering/renderer.ts +++ b/packages/compiler-cli/ngcc/src/rendering/renderer.ts @@ -91,7 +91,7 @@ export abstract class Renderer { const renderedFiles: FileInfo[] = []; // Transform the source files. - this.bundle.src.program.getSourceFiles().map(sourceFile => { + this.bundle.src.program.getSourceFiles().forEach(sourceFile => { const compiledFile = decorationAnalyses.get(sourceFile); const switchMarkerAnalysis = switchMarkerAnalyses.get(sourceFile); diff --git a/packages/compiler-cli/package.json b/packages/compiler-cli/package.json index c1fcaaa607..075288a1d8 100644 --- a/packages/compiler-cli/package.json +++ b/packages/compiler-cli/package.json @@ -24,7 +24,7 @@ }, "peerDependencies": { "@angular/compiler": "0.0.0-PLACEHOLDER", - "typescript": ">=3.3.3333 <3.4" + "typescript": ">=3.4 <3.5" }, "engines": { "node": ">=8.0" @@ -45,4 +45,4 @@ "ng-update": { "packageGroup": "NG_UPDATE_PACKAGE_GROUP" } -} \ No newline at end of file +} diff --git a/packages/compiler-cli/src/transformers/program.ts b/packages/compiler-cli/src/transformers/program.ts index 9165af65a8..f14c259466 100644 --- a/packages/compiler-cli/src/transformers/program.ts +++ b/packages/compiler-cli/src/transformers/program.ts @@ -72,14 +72,14 @@ const defaultEmitCallback: TsEmitCallback = * Minimum supported TypeScript version * ∀ supported typescript version v, v >= MIN_TS_VERSION */ -const MIN_TS_VERSION = '3.3.3333'; +const MIN_TS_VERSION = '3.4.0'; /** * Supremum of supported TypeScript versions * ∀ supported typescript version v, v < MAX_TS_VERSION * MAX_TS_VERSION is not considered as a supported TypeScript version */ -const MAX_TS_VERSION = '3.4.0'; +const MAX_TS_VERSION = '3.5.0'; class AngularCompilerProgram implements Program { private rootNames: string[]; diff --git a/tools/ts-api-guardian/package.json b/tools/ts-api-guardian/package.json index 13944f2b1b..2ebf6cab82 100644 --- a/tools/ts-api-guardian/package.json +++ b/tools/ts-api-guardian/package.json @@ -11,7 +11,7 @@ "test": "test" }, "peerDependencies": { - "typescript": "~3.2.2" + "typescript": "~3.4.0" }, "dependencies": { "chalk": "^2.3.1", @@ -27,7 +27,7 @@ "chai": "^4.1.2", "jasmine": "^3.1.0", "source-map-support": "^0.5.9", - "typescript": "~3.3.3333" + "typescript": "~3.4.2" }, "repository": {}, "keywords": [ @@ -45,4 +45,4 @@ "url": "https://github.com/angular/angular/issues" }, "homepage": "https://github.com/angular/angular/tools/ts-api-guardian" -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index cb215d81c1..fd5ce07e44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10640,10 +10640,10 @@ typescript@~3.1.6: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.6.tgz#b6543a83cfc8c2befb3f4c8fba6896f5b0c9be68" integrity sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA== -typescript@~3.3.3333: - version "3.3.3333" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6" - integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw== +typescript@~3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.2.tgz#9ed4e6475d906f589200193be056f5913caed481" + integrity sha512-Og2Vn6Mk7JAuWA1hQdDQN/Ekm/SchX80VzLhjKN9ETYrIepBFAd8PkOdOTK2nKt0FCkmMZKBJvQ1dV1gIxPu/A== uglify-js@1.2.6, uglify-js@~1.2.5: version "1.2.6"