From 59ef40988e94f3173134368bc7d4e2726cdd8455 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Tue, 16 Mar 2021 20:10:32 +0100 Subject: [PATCH] feat(core): support TypeScript 4.2 (#41158) Updates the repo to TypeScript 4.2 and tslib 2.1.0. PR Close #41158 --- .../dockerbuild/scripts-js/package.json | 4 +- .../dockerbuild/scripts-js/yarn.lock | 16 ++--- .../testing/src/app/demo/async-helper.spec.ts | 8 +-- aio/package.json | 4 +- aio/yarn.lock | 8 +-- dev-infra/build-worker.js | 6 +- dev-infra/ng-dev.js | 22 +++--- integration/BUILD.bazel | 6 ++ integration/typings_test_ts42/include-all.ts | 69 +++++++++++++++++++ integration/typings_test_ts42/package.json | 28 ++++++++ integration/typings_test_ts42/tsconfig.json | 26 +++++++ package.json | 4 +- packages/animations/package.json | 2 +- packages/bazel/package.json | 2 +- packages/common/package.json | 2 +- packages/compiler-cli/package.json | 4 +- .../typecheck/test/span_comments_spec.ts | 5 +- .../typecheck/test/type_check_block_spec.ts | 62 ++++++++--------- .../compiler-cli/src/typescript_support.ts | 2 +- .../test/ngtsc/incremental_spec.ts | 6 +- packages/compiler/package.json | 2 +- packages/core/package.json | 2 +- .../migrations/renderer-to-renderer2/index.ts | 12 ++-- .../migrations/wait-for-async/index.ts | 12 ++-- .../static_queries_migration_usage_spec.ts | 8 +-- ...ecorated_classes_with_di_migration_spec.ts | 5 +- .../utils/typescript/compiler_host.ts | 16 +++-- packages/elements/package.json | 2 +- packages/forms/package.json | 2 +- .../ivy/test/quick_info_spec.ts | 2 +- .../language-service/test/diagnostics_spec.ts | 3 +- .../platform-browser-dynamic/package.json | 2 +- packages/platform-browser/package.json | 2 +- .../test/browser/transfer_state_spec.ts | 9 +-- packages/platform-server/package.json | 2 +- packages/router/package.json | 2 +- packages/service-worker/package.json | 2 +- packages/upgrade/package.json | 2 +- packages/zone.js/package.json | 4 +- .../zone.js/test/browser/FileReader.spec.ts | 4 +- packages/zone.js/test/typings/package.json | 2 +- packages/zone.js/yarn.lock | 16 ++--- tools/ts-api-guardian/package.json | 2 +- yarn.lock | 16 ++--- 44 files changed, 283 insertions(+), 134 deletions(-) create mode 100644 integration/typings_test_ts42/include-all.ts create mode 100644 integration/typings_test_ts42/package.json create mode 100644 integration/typings_test_ts42/tsconfig.json diff --git a/aio/aio-builds-setup/dockerbuild/scripts-js/package.json b/aio/aio-builds-setup/dockerbuild/scripts-js/package.json index f9a7a54bd4..80746a0fa4 100644 --- a/aio/aio-builds-setup/dockerbuild/scripts-js/package.json +++ b/aio/aio-builds-setup/dockerbuild/scripts-js/package.json @@ -33,7 +33,7 @@ "shelljs": "^0.8.4", "source-map-support": "^0.5.19", "tar-stream": "^2.1.3", - "tslib": "^2.0.1" + "tslib": "^2.1.0" }, "devDependencies": { "@types/body-parser": "^1.19.0", @@ -49,6 +49,6 @@ "supertest": "^4.0.2", "tslint": "^6.1.3", "tslint-jasmine-noSkipOrFocus": "^1.0.9", - "typescript": "^4.1.2" + "typescript": "^4.2.3" } } diff --git a/aio/aio-builds-setup/dockerbuild/scripts-js/yarn.lock b/aio/aio-builds-setup/dockerbuild/scripts-js/yarn.lock index f148e6b9a3..6840e7b802 100644 --- a/aio/aio-builds-setup/dockerbuild/scripts-js/yarn.lock +++ b/aio/aio-builds-setup/dockerbuild/scripts-js/yarn.lock @@ -2505,10 +2505,10 @@ tslib@^1.8.1: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" -tslib@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e" - integrity sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ== +tslib@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" + integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== tslint-jasmine-noSkipOrFocus@^1.0.9: version "1.0.9" @@ -2563,10 +2563,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9" - integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ== +typescript@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" + integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== undefsafe@^2.0.2: version "2.0.2" diff --git a/aio/content/examples/testing/src/app/demo/async-helper.spec.ts b/aio/content/examples/testing/src/app/demo/async-helper.spec.ts index 8d9305fc60..7b48af2c87 100644 --- a/aio/content/examples/testing/src/app/demo/async-helper.spec.ts +++ b/aio/content/examples/testing/src/app/demo/async-helper.spec.ts @@ -1,7 +1,7 @@ // tslint:disable-next-line:no-unused-variable -import { fakeAsync, tick, waitForAsync } from '@angular/core/testing'; -import { interval, of } from 'rxjs'; -import { delay, take } from 'rxjs/operators'; +import {fakeAsync, tick, waitForAsync} from '@angular/core/testing'; +import {interval, of} from 'rxjs'; +import {delay, take} from 'rxjs/operators'; describe('Angular async helper', () => { describe('async', () => { @@ -183,7 +183,7 @@ describe('Angular async helper', () => { // before loading zone.js/testing it('should wait until promise.then is called', waitForAsync(() => { let finished = false; - new Promise((res, rej) => { + new Promise(res => { jsonp('localhost:8080/jsonp', () => { // success callback and resolve the promise finished = true; diff --git a/aio/package.json b/aio/package.json index b2f2dca031..655262ae4a 100644 --- a/aio/package.json +++ b/aio/package.json @@ -104,7 +104,7 @@ "@angular/service-worker": "11.2.3", "@webcomponents/custom-elements": "1.2.1", "rxjs": "^6.5.3", - "tslib": "^2.0.0", + "tslib": "^2.1.0", "zone.js": "~0.11.4" }, "devDependencies": { @@ -170,7 +170,7 @@ "tree-kill": "^1.1.0", "ts-node": "^8.4.1", "tslint": "~6.1.0", - "typescript": "~4.1.2", + "typescript": "~4.2.3", "uglify-js": "^3.0.15", "unist-util-filter": "^0.2.1", "unist-util-source": "^1.0.1", diff --git a/aio/yarn.lock b/aio/yarn.lock index 98861aa78d..7b666306b0 100644 --- a/aio/yarn.lock +++ b/aio/yarn.lock @@ -13722,10 +13722,10 @@ typescript@^3.2.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== -typescript@~4.1.2: - version "4.1.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" - integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== +typescript@~4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" + integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== ua-parser-js@^0.7.23: version "0.7.24" diff --git a/dev-infra/build-worker.js b/dev-infra/build-worker.js index 5198e6458e..9754ceb77d 100644 --- a/dev-infra/build-worker.js +++ b/dev-infra/build-worker.js @@ -58,7 +58,7 @@ function buildLogLevelFunction(loadCommand, level) { for (var _i = 0; _i < arguments.length; _i++) { text[_i] = arguments[_i]; } - runConsoleCommand.apply(void 0, tslib.__spread([loadCommand, level], text)); + runConsoleCommand.apply(void 0, tslib.__spreadArray([loadCommand, level], tslib.__read(text))); }; /** Start a group at the LOG_LEVEL, optionally starting it as collapsed. */ loggingFunction.group = function (text, collapsed) { @@ -87,9 +87,9 @@ function runConsoleCommand(loadCommand, logLevel) { text[_i - 2] = arguments[_i]; } if (getLogLevel() >= logLevel) { - loadCommand().apply(void 0, tslib.__spread(text)); + loadCommand().apply(void 0, tslib.__spreadArray([], tslib.__read(text))); } - printToLogFile.apply(void 0, tslib.__spread([logLevel], text)); + printToLogFile.apply(void 0, tslib.__spreadArray([logLevel], tslib.__read(text))); } /** * Retrieve the log level from environment variables, if the value found diff --git a/dev-infra/ng-dev.js b/dev-infra/ng-dev.js index 2df105d26e..2c9464ced2 100755 --- a/dev-infra/ng-dev.js +++ b/dev-infra/ng-dev.js @@ -239,7 +239,7 @@ function promptAutocomplete(message, choices, noChoiceText) { case 0: prompt = inquirer.createPromptModule({}).registerPrompt('autocomplete', inquirerAutocomplete); if (noChoiceText) { - choices = tslib.__spread([noChoiceText], choices); + choices = tslib.__spreadArray([noChoiceText], tslib.__read(choices)); } return [4 /*yield*/, prompt({ type: 'autocomplete', @@ -313,7 +313,7 @@ function buildLogLevelFunction(loadCommand, level) { for (var _i = 0; _i < arguments.length; _i++) { text[_i] = arguments[_i]; } - runConsoleCommand.apply(void 0, tslib.__spread([loadCommand, level], text)); + runConsoleCommand.apply(void 0, tslib.__spreadArray([loadCommand, level], tslib.__read(text))); }; /** Start a group at the LOG_LEVEL, optionally starting it as collapsed. */ loggingFunction.group = function (text, collapsed) { @@ -342,9 +342,9 @@ function runConsoleCommand(loadCommand, logLevel) { text[_i - 2] = arguments[_i]; } if (getLogLevel() >= logLevel) { - loadCommand().apply(void 0, tslib.__spread(text)); + loadCommand().apply(void 0, tslib.__spreadArray([], tslib.__read(text))); } - printToLogFile.apply(void 0, tslib.__spread([logLevel], text)); + printToLogFile.apply(void 0, tslib.__spreadArray([logLevel], tslib.__read(text))); } /** * Retrieve the log level from environment variables, if the value found @@ -2254,7 +2254,7 @@ function allChangedFilesSince(sha) { var diffFiles = gitOutputAsArray("git diff --name-only --diff-filter=d " + sha); var untrackedFiles = gitOutputAsArray("git ls-files --others --exclude-standard"); // Use a set to deduplicate the list as its possible for a file to show up in both lists. - return Array.from(new Set(tslib.__spread(diffFiles, untrackedFiles))); + return Array.from(new Set(tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(diffFiles)), tslib.__read(untrackedFiles)))); } /** * A list of all staged files which have been modified. @@ -2947,7 +2947,7 @@ function getPr(prSchema, prNumber, git) { PR_QUERY = typedGraphqlify.params({ $number: 'Int!', $owner: 'String!', - $name: 'String!', + $name: 'String!', // The organization to query for }, { repository: typedGraphqlify.params({ owner: '$owner', name: '$name' }, { pullRequest: typedGraphqlify.params({ number: '$number' }, prSchema), @@ -2973,7 +2973,7 @@ function getPendingPrs(prSchema, git) { $first: 'Int', $after: 'String', $owner: 'String!', - $name: 'String!', + $name: 'String!', // The repository to query for }, { repository: typedGraphqlify.params({ owner: '$owner', name: '$name' }, { pullRequests: typedGraphqlify.params({ @@ -3003,7 +3003,7 @@ function getPendingPrs(prSchema, git) { return [4 /*yield*/, git.github.graphql.query(PRS_QUERY, params_1)]; case 2: results = _b.sent(); - prs.push.apply(prs, tslib.__spread(results.repository.pullRequests.nodes)); + prs.push.apply(prs, tslib.__spreadArray([], tslib.__read(results.repository.pullRequests.nodes))); hasNextPage = results.repository.pullRequests.pageInfo.hasNextPage; cursor = results.repository.pullRequests.pageInfo.endCursor; return [3 /*break*/, 1]; @@ -3598,7 +3598,7 @@ var MergeStrategy = /** @class */ (function () { // Checkout the local target branch. this.git.run(['checkout', localTargetBranch]); // Cherry-pick the refspec into the target branch. - if (this.git.runGraceful(tslib.__spread(['cherry-pick'], cherryPickArgs)).status !== 0) { + if (this.git.runGraceful(tslib.__spreadArray(['cherry-pick'], tslib.__read(cherryPickArgs))).status !== 0) { // Abort the failed cherry-pick. We do this because Git persists the failed // cherry-pick state globally in the repository. This could prevent future // pull request merges as a Git thinks a cherry-pick is still in progress. @@ -3637,7 +3637,7 @@ var MergeStrategy = /** @class */ (function () { }); // Fetch all target branches with a single command. We don't want to fetch them // individually as that could cause an unnecessary slow-down. - this.git.run(tslib.__spread(['fetch', '-q', '-f', this.git.repoGitUrl], fetchRefspecs, extraRefspecs)); + this.git.run(tslib.__spreadArray(tslib.__spreadArray(['fetch', '-q', '-f', this.git.repoGitUrl], tslib.__read(fetchRefspecs)), tslib.__read(extraRefspecs))); }; /** Pushes the given target branches upstream. */ MergeStrategy.prototype.pushTargetBranchesUpstream = function (names) { @@ -3648,7 +3648,7 @@ var MergeStrategy = /** @class */ (function () { }); // Push all target branches with a single command if we don't run in dry-run mode. // We don't want to push them individually as that could cause an unnecessary slow-down. - this.git.run(tslib.__spread(['push', this.git.repoGitUrl], pushRefspecs)); + this.git.run(tslib.__spreadArray(['push', this.git.repoGitUrl], tslib.__read(pushRefspecs))); }; return MergeStrategy; }()); diff --git a/integration/BUILD.bazel b/integration/BUILD.bazel index 7d29c30410..744fa88bf8 100644 --- a/integration/BUILD.bazel +++ b/integration/BUILD.bazel @@ -97,6 +97,12 @@ INTEGRATION_TESTS = { # root @npm//typescript package. "pinned_npm_packages": ["typescript"], }, + "typings_test_ts42": { + # Special case for `typings_test_ts42` test as we want to pin + # `typescript` at version 4.2.x for that test and not link to the + # root @npm//typescript package. + "pinned_npm_packages": ["typescript"], + }, } [ diff --git a/integration/typings_test_ts42/include-all.ts b/integration/typings_test_ts42/include-all.ts new file mode 100644 index 0000000000..86b57f2789 --- /dev/null +++ b/integration/typings_test_ts42/include-all.ts @@ -0,0 +1,69 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + + + +import * as animations from '@angular/animations'; +import * as animationsBrowser from '@angular/animations/browser'; +import * as animationsBrowserTesting from '@angular/animations/browser/testing'; +import * as common from '@angular/common'; +import * as commonHttp from '@angular/common/http'; +import * as commonTesting from '@angular/common/testing'; +import * as commonHttpTesting from '@angular/common/testing'; +import * as compiler from '@angular/compiler'; +import * as compilerTesting from '@angular/compiler/testing'; +import * as core from '@angular/core'; +import * as coreTesting from '@angular/core/testing'; +import * as elements from '@angular/elements'; +import * as forms from '@angular/forms'; +import * as platformBrowser from '@angular/platform-browser'; +import * as platformBrowserDynamic from '@angular/platform-browser-dynamic'; +import * as platformBrowserDynamicTesting from '@angular/platform-browser-dynamic/testing'; +import * as platformBrowserAnimations from '@angular/platform-browser/animations'; +import * as platformBrowserTesting from '@angular/platform-browser/testing'; +import * as platformServer from '@angular/platform-server'; +import * as platformServerInit from '@angular/platform-server/init'; +import * as platformServerTesting from '@angular/platform-server/testing'; +import * as router from '@angular/router'; +import * as routerTesting from '@angular/router/testing'; +import * as routerUpgrade from '@angular/router/upgrade'; +import * as serviceWorker from '@angular/service-worker'; +import * as upgrade from '@angular/upgrade'; +import * as upgradeStatic from '@angular/upgrade/static'; +import * as upgradeTesting from '@angular/upgrade/static/testing'; + +export default { + animations, + animationsBrowser, + animationsBrowserTesting, + common, + commonTesting, + commonHttp, + commonHttpTesting, + compiler, + compilerTesting, + core, + coreTesting, + elements, + forms, + platformBrowser, + platformBrowserTesting, + platformBrowserDynamic, + platformBrowserDynamicTesting, + platformBrowserAnimations, + platformServer, + platformServerInit, + platformServerTesting, + router, + routerTesting, + routerUpgrade, + serviceWorker, + upgrade, + upgradeStatic, + upgradeTesting, +}; diff --git a/integration/typings_test_ts42/package.json b/integration/typings_test_ts42/package.json new file mode 100644 index 0000000000..58b8e64f9b --- /dev/null +++ b/integration/typings_test_ts42/package.json @@ -0,0 +1,28 @@ +{ + "name": "angular-integration", + "description": "Assert that users with TypeScript 4.2 can type-check an Angular application", + "version": "0.0.0", + "license": "MIT", + "dependencies": { + "@angular/animations": "file:../../dist/packages-dist/animations", + "@angular/common": "file:../../dist/packages-dist/common", + "@angular/compiler": "file:../../dist/packages-dist/compiler", + "@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli", + "@angular/core": "file:../../dist/packages-dist/core", + "@angular/elements": "file:../../dist/packages-dist/elements", + "@angular/forms": "file:../../dist/packages-dist/forms", + "@angular/platform-browser": "file:../../dist/packages-dist/platform-browser", + "@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic", + "@angular/platform-server": "file:../../dist/packages-dist/platform-server", + "@angular/router": "file:../../dist/packages-dist/router", + "@angular/service-worker": "file:../../dist/packages-dist/service-worker", + "@angular/upgrade": "file:../../dist/packages-dist/upgrade", + "@types/jasmine": "file:../../node_modules/@types/jasmine", + "rxjs": "file:../../node_modules/rxjs", + "typescript": "4.2.3", + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" + }, + "scripts": { + "test": "tsc" + } +} diff --git a/integration/typings_test_ts42/tsconfig.json b/integration/typings_test_ts42/tsconfig.json new file mode 100644 index 0000000000..30e25c2209 --- /dev/null +++ b/integration/typings_test_ts42/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "experimentalDecorators": true, + "module": "commonjs", + "moduleResolution": "node", + "outDir": "./dist/out-tsc", + "rootDir": ".", + "target": "es5", + "lib": [ + "es5", + "dom", + "es2015.collection", + "es2015.iterable", + "es2015.promise" + ], + "types": [], + }, + "files": [ + "include-all.ts", + "node_modules/@types/jasmine/index.d.ts" + ] +} diff --git a/package.json b/package.json index ef60329968..9c36c54e3a 100644 --- a/package.json +++ b/package.json @@ -152,9 +152,9 @@ "systemjs": "0.18.10", "terser": "^4.4.0", "tsickle": "0.38.1", - "tslib": "^2.0.0", + "tslib": "^2.1.0", "tslint": "6.1.3", - "typescript": "~4.1.2", + "typescript": "~4.2.3", "xhr2": "0.2.0", "yaml": "^1.10.0", "yargs": "^16.1.1" diff --git a/packages/animations/package.json b/packages/animations/package.json index ab9225695b..7a9a1c50f3 100644 --- a/packages/animations/package.json +++ b/packages/animations/package.json @@ -5,7 +5,7 @@ "author": "angular", "license": "MIT", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "@angular/core": "0.0.0-PLACEHOLDER" diff --git a/packages/bazel/package.json b/packages/bazel/package.json index aa65c45fad..8d0a16d029 100644 --- a/packages/bazel/package.json +++ b/packages/bazel/package.json @@ -28,7 +28,7 @@ "@angular/compiler-cli": "0.0.0-PLACEHOLDER", "@bazel/typescript": ">=1.0.0", "terser": "^4.3.1", - "typescript": ">=4.0 <4.2", + "typescript": ">=4.0 <4.3", "rollup": ">=1.20.0", "rollup-plugin-commonjs": ">=9.0.0", "rollup-plugin-node-resolve": ">=4.2.0", diff --git a/packages/common/package.json b/packages/common/package.json index b942b2fa21..0545b7b509 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -6,7 +6,7 @@ "license": "MIT", "locales": "locales", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "@angular/core": "0.0.0-PLACEHOLDER", diff --git a/packages/compiler-cli/package.json b/packages/compiler-cli/package.json index d47c5f2da5..8ab09b6578 100644 --- a/packages/compiler-cli/package.json +++ b/packages/compiler-cli/package.json @@ -24,12 +24,12 @@ "semver": "^6.3.0", "source-map": "^0.6.1", "sourcemap-codec": "^1.4.8", - "tslib": "^2.0.0", + "tslib": "^2.1.0", "yargs": "^16.1.1" }, "peerDependencies": { "@angular/compiler": "0.0.0-PLACEHOLDER", - "typescript": ">=4.0 <4.2" + "typescript": ">=4.0 <4.3" }, "engines": { "node": ">=10.0" diff --git a/packages/compiler-cli/src/ngtsc/typecheck/test/span_comments_spec.ts b/packages/compiler-cli/src/ngtsc/typecheck/test/span_comments_spec.ts index c485201f29..dae00dc0ef 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/test/span_comments_spec.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/test/span_comments_spec.ts @@ -116,15 +116,14 @@ describe('type check blocks diagnostics', () => { it('should annotate safe property access', () => { const TEMPLATE = `{{ a?.b }}`; expect(tcbWithSpans(TEMPLATE)) - .toContain( - '((null as any) ? (((ctx).a /*3,4*/) /*3,4*/)!.b /*6,7*/ : undefined) /*3,7*/'); + .toContain('(null as any ? (((ctx).a /*3,4*/) /*3,4*/)!.b /*6,7*/ : undefined) /*3,7*/'); }); it('should annotate safe method calls', () => { const TEMPLATE = `{{ a?.method(b) }}`; expect(tcbWithSpans(TEMPLATE)) .toContain( - '((null as any) ? (((ctx).a /*3,4*/) /*3,4*/)!.method /*6,12*/(((ctx).b /*13,14*/) /*13,14*/) : undefined) /*3,15*/'); + '(null as any ? (((ctx).a /*3,4*/) /*3,4*/)!.method /*6,12*/(((ctx).b /*13,14*/) /*13,14*/) : undefined) /*3,15*/'); }); it('should annotate $any casts', () => { diff --git a/packages/compiler-cli/src/ngtsc/typecheck/test/type_check_block_spec.ts b/packages/compiler-cli/src/ngtsc/typecheck/test/type_check_block_spec.ts index 3c9e7ef0e9..6dc48d7c34 100644 --- a/packages/compiler-cli/src/ngtsc/typecheck/test/type_check_block_spec.ts +++ b/packages/compiler-cli/src/ngtsc/typecheck/test/type_check_block_spec.ts @@ -60,7 +60,7 @@ describe('type check blocks', () => { selector: '[dir]', inputs: {inputA: 'inputA'}, }]; - expect(tcb(TEMPLATE, DIRECTIVES)).toContain('_t1: DirA = (null!); _t1.inputA = ("value");'); + expect(tcb(TEMPLATE, DIRECTIVES)).toContain('_t1: DirA = null!; _t1.inputA = ("value");'); }); it('should handle multiple bindings to the same property', () => { @@ -135,7 +135,7 @@ describe('type check blocks', () => { }]; expect(tcb(TEMPLATE, DIRECTIVES)) .toContain( - 'var _t1 = Dir.ngTypeCtor({ "fieldA": (((ctx).foo)), "fieldB": (null as any) });'); + 'var _t1 = Dir.ngTypeCtor({ "fieldA": (((ctx).foo)), "fieldB": null as any });'); }); it('should handle multiple bindings to the same property', () => { @@ -261,7 +261,7 @@ describe('type check blocks', () => { }]; expect(tcb(TEMPLATE, DIRECTIVES)) .toContain( - 'var _t1: typeof Dir.ngAcceptInputType_fieldA = (null!); ' + + 'var _t1: typeof Dir.ngAcceptInputType_fieldA = null!; ' + '_t1 = (((ctx).foo));'); }); }); @@ -321,11 +321,11 @@ describe('type check blocks', () => { }, ]; const block = tcb(TEMPLATE, DIRECTIVES); - expect(block).toContain('var _t1: HasInput = (null!)'); + expect(block).toContain('var _t1: HasInput = null!'); expect(block).toContain('_t1.input = (((ctx).value));'); - expect(block).toContain('var _t2: HasOutput = (null!)'); + expect(block).toContain('var _t2: HasOutput = null!'); expect(block).toContain('_t2["output"]'); - expect(block).toContain('var _t4: HasReference = (null!)'); + expect(block).toContain('var _t4: HasReference = null!'); expect(block).toContain('var _t3 = _t4;'); expect(block).toContain('(_t3).a'); expect(block).not.toContain('NoBindings'); @@ -355,7 +355,7 @@ describe('type check blocks', () => { }]; expect(tcb(TEMPLATE, DIRECTIVES)) .toContain( - 'var _t2: Dir = (null!); ' + + 'var _t2: Dir = null!; ' + 'var _t1 = _t2; ' + '"" + (((_t1).value));'); }); @@ -383,7 +383,7 @@ describe('type check blocks', () => { inputs: {'color': 'color', 'strong': 'strong', 'enabled': 'enabled'}, }]; const block = tcb(TEMPLATE, DIRECTIVES); - expect(block).not.toContain('var _t1: Dir = (null!);'); + expect(block).not.toContain('var _t1: Dir = null!;'); expect(block).not.toContain('"color"'); expect(block).not.toContain('"strong"'); expect(block).not.toContain('"enabled"'); @@ -403,7 +403,7 @@ describe('type check blocks', () => { }]; expect(tcb(TEMPLATE, DIRECTIVES)) .toContain( - 'var _t2: Dir = (null!); ' + + 'var _t2: Dir = null!; ' + 'var _t1 = _t2; ' + '_t2.input = (_t1);'); }); @@ -431,9 +431,9 @@ describe('type check blocks', () => { ]; expect(tcb(TEMPLATE, DIRECTIVES)) .toContain( - 'var _t2: DirB = (null!); ' + + 'var _t2: DirB = null!; ' + 'var _t1 = _t2; ' + - 'var _t3: DirA = (null!); ' + + 'var _t3: DirA = null!; ' + '_t3.inputA = (_t1); ' + 'var _t4 = _t3; ' + '_t2.inputA = (_t4);'); @@ -451,7 +451,7 @@ describe('type check blocks', () => { undeclaredInputFields: ['fieldA'] }]; const block = tcb(TEMPLATE, DIRECTIVES); - expect(block).not.toContain('var _t1: Dir = (null!);'); + expect(block).not.toContain('var _t1: Dir = null!;'); expect(block).toContain('(((ctx).foo)); '); }); @@ -468,8 +468,8 @@ describe('type check blocks', () => { }]; expect(tcb(TEMPLATE, DIRECTIVES)) .toContain( - 'var _t1: Dir = (null!); ' + - 'var _t2: typeof _t1["fieldA"] = (null!); ' + + 'var _t1: Dir = null!; ' + + 'var _t2: typeof _t1["fieldA"] = null!; ' + '_t2 = (((ctx).foo)); '); }); @@ -487,7 +487,7 @@ describe('type check blocks', () => { }]; const block = tcb(TEMPLATE, DIRECTIVES); expect(block).toContain( - 'var _t1: Dir = (null!); ' + + 'var _t1: Dir = null!; ' + '_t1["some-input.xs"] = (((ctx).foo)); '); }); @@ -504,7 +504,7 @@ describe('type check blocks', () => { }]; expect(tcb(TEMPLATE, DIRECTIVES)) .toContain( - 'var _t1: Dir = (null!); ' + + 'var _t1: Dir = null!; ' + '_t1.field2 = _t1.field1 = (((ctx).foo));'); }); @@ -523,8 +523,8 @@ describe('type check blocks', () => { }]; expect(tcb(TEMPLATE, DIRECTIVES)) .toContain( - 'var _t1: typeof Dir.ngAcceptInputType_field1 = (null!); ' + - 'var _t2: Dir = (null!); ' + + 'var _t1: typeof Dir.ngAcceptInputType_field1 = null!; ' + + 'var _t2: Dir = null!; ' + '_t2.field2 = _t1 = (((ctx).foo));'); }); @@ -543,7 +543,7 @@ describe('type check blocks', () => { }]; expect(tcb(TEMPLATE, DIRECTIVES)) .toContain( - 'var _t1: Dir = (null!); ' + + 'var _t1: Dir = null!; ' + '_t1.field2 = (((ctx).foo));'); }); @@ -559,9 +559,9 @@ describe('type check blocks', () => { coercedInputFields: ['fieldA'], }]; const block = tcb(TEMPLATE, DIRECTIVES); - expect(block).not.toContain('var _t1: Dir = (null!);'); + expect(block).not.toContain('var _t1: Dir = null!;'); expect(block).toContain( - 'var _t1: typeof Dir.ngAcceptInputType_fieldA = (null!); ' + + 'var _t1: typeof Dir.ngAcceptInputType_fieldA = null!; ' + '_t1 = (((ctx).foo));'); }); @@ -578,9 +578,9 @@ describe('type check blocks', () => { undeclaredInputFields: ['fieldA'], }]; const block = tcb(TEMPLATE, DIRECTIVES); - expect(block).not.toContain('var _t1: Dir = (null!);'); + expect(block).not.toContain('var _t1: Dir = null!;'); expect(block).toContain( - 'var _t1: typeof Dir.ngAcceptInputType_fieldA = (null!); ' + + 'var _t1: typeof Dir.ngAcceptInputType_fieldA = null!; ' + '_t1 = (((ctx).foo));'); }); @@ -893,7 +893,7 @@ describe('type check blocks', () => { TypeCheckingConfig = {...BASE_CONFIG, checkTypeOfDomReferences: false}; const block = tcb(TEMPLATE, [], DISABLED_CONFIG); expect(block).toContain( - 'var _t1 = (_t2 as any); ' + + 'var _t1 = _t2 as any; ' + '"" + (((_t1).value));'); }); }); @@ -928,7 +928,7 @@ describe('type check blocks', () => { TypeCheckingConfig = {...BASE_CONFIG, checkTypeOfNonDomReferences: false}; const block = tcb(TEMPLATE, DIRECTIVES, DISABLED_CONFIG); expect(block).toContain( - 'var _t1 = (_t2 as any); ' + + 'var _t1 = _t2 as any; ' + '"" + (((_t1).value));'); }); }); @@ -983,8 +983,8 @@ describe('type check blocks', () => { it('should use undefined for safe navigation operations when enabled', () => { const block = tcb(TEMPLATE, DIRECTIVES); - expect(block).toContain('((null as any) ? (((ctx).a))!.method() : undefined)'); - expect(block).toContain('((null as any) ? (((ctx).a))!.b : undefined)'); + expect(block).toContain('(null as any ? (((ctx).a))!.method() : undefined)'); + expect(block).toContain('(null as any ? (((ctx).a))!.b : undefined)'); }); it('should use an \'any\' type for safe navigation operations when disabled', () => { const DISABLED_CONFIG: @@ -999,8 +999,8 @@ describe('type check blocks', () => { const TEMPLATE = `{{a.method()?.b}} {{a()?.method()}}`; it('should check the presence of a property/method on the receiver when enabled', () => { const block = tcb(TEMPLATE, DIRECTIVES); - expect(block).toContain('((null as any) ? ((((ctx).a)).method())!.b : undefined)'); - expect(block).toContain('((null as any) ? ((ctx).a())!.method() : undefined)'); + expect(block).toContain('(null as any ? ((((ctx).a)).method())!.b : undefined)'); + expect(block).toContain('(null as any ? ((ctx).a())!.method() : undefined)'); }); it('should not check the presence of a property/method on the receiver when disabled', () => { const DISABLED_CONFIG: @@ -1045,7 +1045,7 @@ describe('type check blocks', () => { TypeCheckingConfig = {...BASE_CONFIG, honorAccessModifiersForInputBindings: true}; const block = tcb(TEMPLATE, DIRECTIVES, enableChecks); expect(block).toContain( - 'var _t1: Dir = (null!); ' + + 'var _t1: Dir = null!; ' + '_t1["some-input.xs"] = (((ctx).foo)); '); }); @@ -1063,7 +1063,7 @@ describe('type check blocks', () => { TypeCheckingConfig = {...BASE_CONFIG, honorAccessModifiersForInputBindings: true}; const block = tcb(TEMPLATE, DIRECTIVES, enableChecks); expect(block).toContain( - 'var _t1: Dir = (null!); ' + + 'var _t1: Dir = null!; ' + '_t1.fieldA = (((ctx).foo)); '); }); }); diff --git a/packages/compiler-cli/src/typescript_support.ts b/packages/compiler-cli/src/typescript_support.ts index efdd34c8de..ca41c33081 100644 --- a/packages/compiler-cli/src/typescript_support.ts +++ b/packages/compiler-cli/src/typescript_support.ts @@ -25,7 +25,7 @@ const MIN_TS_VERSION = '4.0.0'; * Note: this check is disabled in g3, search for * `angularCompilerOptions.disableTypeScriptVersionCheck` config param value in g3. */ -const MAX_TS_VERSION = '4.2.0'; +const MAX_TS_VERSION = '4.3.0'; /** * The currently used version of TypeScript, which can be adjusted for testing purposes using diff --git a/packages/compiler-cli/test/ngtsc/incremental_spec.ts b/packages/compiler-cli/test/ngtsc/incremental_spec.ts index 2dca44d04d..06c65d53cb 100644 --- a/packages/compiler-cli/test/ngtsc/incremental_spec.ts +++ b/packages/compiler-cli/test/ngtsc/incremental_spec.ts @@ -769,12 +769,14 @@ runInEachFileSystem(() => { let diags = env.driveDiagnostics(); expect(diags.length).toBe(1); - expect(diags[0].messageText).toContain('"alpha" | "beta"'); + expect(diags[0].messageText) + .toContain(`Type '"gamma"' is not assignable to type 'keyof Keys'.`); // On a rebuild, the same errors should be present. diags = env.driveDiagnostics(); expect(diags.length).toBe(1); - expect(diags[0].messageText).toContain('"alpha" | "beta"'); + expect(diags[0].messageText) + .toContain(`Type '"gamma"' is not assignable to type 'keyof Keys'.`); }); }); }); diff --git a/packages/compiler/package.json b/packages/compiler/package.json index b12dee8beb..2c9256deba 100644 --- a/packages/compiler/package.json +++ b/packages/compiler/package.json @@ -5,7 +5,7 @@ "author": "angular", "license": "MIT", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "repository": { "type": "git", diff --git a/packages/core/package.json b/packages/core/package.json index a75bfaa07e..f365d07681 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -5,7 +5,7 @@ "author": "angular", "license": "MIT", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "rxjs": "^6.5.3", diff --git a/packages/core/schematics/migrations/renderer-to-renderer2/index.ts b/packages/core/schematics/migrations/renderer-to-renderer2/index.ts index 9caa76a98c..e3bc12466d 100644 --- a/packages/core/schematics/migrations/renderer-to-renderer2/index.ts +++ b/packages/core/schematics/migrations/renderer-to-renderer2/index.ts @@ -7,7 +7,7 @@ */ import {Rule, SchematicsException, Tree} from '@angular-devkit/schematics'; -import {relative} from 'path'; +import {basename, join, relative} from 'path'; import * as ts from 'typescript'; import {getProjectTsConfigPaths} from '../../utils/project_tsconfig_paths'; @@ -43,11 +43,15 @@ export default function(): Rule { } function runRendererToRenderer2Migration(tree: Tree, tsconfigPath: string, basePath: string) { + // Technically we can get away with using `MODULE_AUGMENTATION_FILENAME` as the path, but as of + // TS 4.2, the module resolution caching seems to be more aggressive which causes the file to be + // retained between test runs. We can avoid it by using the full path. + const augmentedFilePath = join(basePath, MODULE_AUGMENTATION_FILENAME); const {program} = createMigrationProgram(tree, tsconfigPath, basePath, fileName => { // In case the module augmentation file has been requested, we return a source file that // augments "@angular/core" to include a named export called "Renderer". This ensures that // we can rely on the type checker for this migration in v9 where "Renderer" has been removed. - if (fileName === MODULE_AUGMENTATION_FILENAME) { + if (basename(fileName) === MODULE_AUGMENTATION_FILENAME) { return ` import '@angular/core'; declare module "@angular/core" { @@ -55,8 +59,8 @@ function runRendererToRenderer2Migration(tree: Tree, tsconfigPath: string, baseP } `; } - return null; - }, [MODULE_AUGMENTATION_FILENAME]); + return undefined; + }, [augmentedFilePath]); const typeChecker = program.getTypeChecker(); const printer = ts.createPrinter(); const sourceFiles = diff --git a/packages/core/schematics/migrations/wait-for-async/index.ts b/packages/core/schematics/migrations/wait-for-async/index.ts index 8c04faa58d..fb0804ef9c 100644 --- a/packages/core/schematics/migrations/wait-for-async/index.ts +++ b/packages/core/schematics/migrations/wait-for-async/index.ts @@ -7,7 +7,7 @@ */ import {Rule, SchematicsException, Tree} from '@angular-devkit/schematics'; -import {relative} from 'path'; +import {basename, join, relative} from 'path'; import * as ts from 'typescript'; import {getProjectTsConfigPaths} from '../../utils/project_tsconfig_paths'; @@ -38,11 +38,15 @@ export default function(): Rule { } function runWaitForAsyncMigration(tree: Tree, tsconfigPath: string, basePath: string) { + // Technically we can get away with using `MODULE_AUGMENTATION_FILENAME` as the path, but as of + // TS 4.2, the module resolution caching seems to be more aggressive which causes the file to be + // retained between test runs. We can avoid it by using the full path. + const augmentedFilePath = join(basePath, MODULE_AUGMENTATION_FILENAME); const {program} = createMigrationProgram(tree, tsconfigPath, basePath, fileName => { // In case the module augmentation file has been requested, we return a source file that // augments "@angular/core/testing" to include a named export called "async". This ensures that // we can rely on the type checker for this migration after `async` has been removed. - if (fileName === MODULE_AUGMENTATION_FILENAME) { + if (basename(fileName) === MODULE_AUGMENTATION_FILENAME) { return ` import '@angular/core/testing'; declare module "@angular/core/testing" { @@ -50,8 +54,8 @@ function runWaitForAsyncMigration(tree: Tree, tsconfigPath: string, basePath: st } `; } - return null; - }, [MODULE_AUGMENTATION_FILENAME]); + return undefined; + }, [augmentedFilePath]); const typeChecker = program.getTypeChecker(); const printer = ts.createPrinter(); const sourceFiles = diff --git a/packages/core/schematics/test/static_queries_migration_usage_spec.ts b/packages/core/schematics/test/static_queries_migration_usage_spec.ts index ed1e2d3495..af708d2adb 100644 --- a/packages/core/schematics/test/static_queries_migration_usage_spec.ts +++ b/packages/core/schematics/test/static_queries_migration_usage_spec.ts @@ -683,13 +683,13 @@ describe('static-queries migration with usage strategy', () => { it('should not mark queries used in promises as static', async () => { writeFile('/es2015.dom.d.ts', ` interface PromiseConstructor { - resolve(): Promise; - reject(): Promise; + resolve(): Promise; + reject(): Promise; } interface Promise { - then(cb: Function): Promise; - catch(cb: Function): Promise; + then(cb: Function): Promise; + catch(cb: Function): Promise; } declare var Promise: PromiseConstructor; diff --git a/packages/core/schematics/test/undecorated_classes_with_di_migration_spec.ts b/packages/core/schematics/test/undecorated_classes_with_di_migration_spec.ts index 282962fedc..0b7242db13 100644 --- a/packages/core/schematics/test/undecorated_classes_with_di_migration_spec.ts +++ b/packages/core/schematics/test/undecorated_classes_with_di_migration_spec.ts @@ -1484,7 +1484,10 @@ describe('Undecorated classes with DI migration', () => { {flatModuleId: 'AUTOGENERATED', flatModuleOutFile: 'AUTOGENERATED'} })); - writeFile('/second.ts', ``); + // This file doesn't do anything, but it's necessary in order to hit the code path for + // the assertion. As of TS 4.2 it needs to have _some_ kind of content, otherwise the + // compiler will throw an error. + writeFile('/second.ts', `export const foo = 1;`); writeFile('/test.ts', ` import {Injectable, NgModule, NgZone} from '@angular/core'; diff --git a/packages/core/schematics/utils/typescript/compiler_host.ts b/packages/core/schematics/utils/typescript/compiler_host.ts index e39bdbc8ec..a4c159d65a 100644 --- a/packages/core/schematics/utils/typescript/compiler_host.ts +++ b/packages/core/schematics/utils/typescript/compiler_host.ts @@ -10,7 +10,7 @@ import {dirname, relative, resolve} from 'path'; import * as ts from 'typescript'; import {parseTsconfigFile} from './parse_tsconfig'; -export type FakeReadFileFn = (fileName: string) => string|null; +export type FakeReadFileFn = (fileName: string) => string|undefined; /** * Creates a TypeScript program instance for a TypeScript project within @@ -40,6 +40,7 @@ export function createMigrationCompilerHost( tree: Tree, options: ts.CompilerOptions, basePath: string, fakeRead?: FakeReadFileFn): ts.CompilerHost { const host = ts.createCompilerHost(options, true); + const defaultReadFile = host.readFile; // We need to overwrite the host "readFile" method, as we want the TypeScript // program to be based on the file contents in the virtual file tree. Otherwise @@ -47,12 +48,19 @@ export function createMigrationCompilerHost( // source files. host.readFile = fileName => { const treeRelativePath = relative(basePath, fileName); - const fakeOutput = fakeRead ? fakeRead(treeRelativePath) : null; - const buffer = fakeOutput === null ? tree.read(treeRelativePath) : fakeOutput; + let result: string|undefined = fakeRead?.(treeRelativePath); + + if (result === undefined) { + // If the relative path resolved to somewhere outside of the tree, fall back to + // TypeScript's default file reading function since the `tree` will throw an error. + result = treeRelativePath.startsWith('..') ? defaultReadFile.call(host, fileName) : + tree.read(treeRelativePath)?.toString(); + } + // Strip BOM as otherwise TSC methods (Ex: getWidth) will return an offset, // which breaks the CLI UpdateRecorder. // See: https://github.com/angular/angular/pull/30719 - return buffer ? buffer.toString().replace(/^\uFEFF/, '') : undefined; + return result ? result.replace(/^\uFEFF/, '') : undefined; }; return host; diff --git a/packages/elements/package.json b/packages/elements/package.json index b805c9cf0a..e1a1dd38bd 100644 --- a/packages/elements/package.json +++ b/packages/elements/package.json @@ -5,7 +5,7 @@ "author": "angular", "license": "MIT", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "@angular/core": "0.0.0-PLACEHOLDER", diff --git a/packages/forms/package.json b/packages/forms/package.json index 90d056a38b..5797bbeb80 100644 --- a/packages/forms/package.json +++ b/packages/forms/package.json @@ -5,7 +5,7 @@ "author": "angular", "license": "MIT", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "@angular/core": "0.0.0-PLACEHOLDER", diff --git a/packages/language-service/ivy/test/quick_info_spec.ts b/packages/language-service/ivy/test/quick_info_spec.ts index 41e8b4bf2b..817f127680 100644 --- a/packages/language-service/ivy/test/quick_info_spec.ts +++ b/packages/language-service/ivy/test/quick_info_spec.ts @@ -216,7 +216,7 @@ describe('quick info', () => { templateOverride: `
`, expectedSpanText: 'of', expectedDisplayString: - '(property) NgForOf.ngForOf: Hero[] | (Hero[] & Iterable) | null | undefined' + '(property) NgForOf.ngForOf: (Hero[] & NgIterable) | null | undefined' }); }); diff --git a/packages/language-service/test/diagnostics_spec.ts b/packages/language-service/test/diagnostics_spec.ts index 99b2ce9bb0..8397e655e1 100644 --- a/packages/language-service/test/diagnostics_spec.ts +++ b/packages/language-service/test/diagnostics_spec.ts @@ -830,8 +830,7 @@ describe('diagnostics', () => { const tsDiags = tsLS.getSemanticDiagnostics(APP_COMPONENT); expect(tsDiags.length).toBe(1); expect(tsDiags[0].messageText) - .toBe( - `Module '"../node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.`); + .toBe(`Module '"@angular/core"' has no exported member 'OpaqueToken'.`); }); describe('templates', () => { diff --git a/packages/platform-browser-dynamic/package.json b/packages/platform-browser-dynamic/package.json index 9678daccca..176fcc7396 100644 --- a/packages/platform-browser-dynamic/package.json +++ b/packages/platform-browser-dynamic/package.json @@ -5,7 +5,7 @@ "author": "angular", "license": "MIT", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "@angular/core": "0.0.0-PLACEHOLDER", diff --git a/packages/platform-browser/package.json b/packages/platform-browser/package.json index e5b80e800d..a44b8c87f6 100644 --- a/packages/platform-browser/package.json +++ b/packages/platform-browser/package.json @@ -5,7 +5,7 @@ "author": "angular", "license": "MIT", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "@angular/animations": "0.0.0-PLACEHOLDER", diff --git a/packages/platform-browser/test/browser/transfer_state_spec.ts b/packages/platform-browser/test/browser/transfer_state_spec.ts index 3a6b1226f9..72445d12f9 100644 --- a/packages/platform-browser/test/browser/transfer_state_spec.ts +++ b/packages/platform-browser/test/browser/transfer_state_spec.ts @@ -9,7 +9,7 @@ import {DOCUMENT} from '@angular/common'; import {TestBed} from '@angular/core/testing'; import {BrowserModule, BrowserTransferStateModule, TransferState} from '@angular/platform-browser'; -import {escapeHtml, makeStateKey, StateKey, unescapeHtml} from '@angular/platform-browser/src/browser/transfer_state'; +import {escapeHtml, makeStateKey, unescapeHtml} from '@angular/platform-browser/src/browser/transfer_state'; (function() { function removeScriptTag(doc: Document, id: string) { @@ -37,6 +37,7 @@ describe('TransferState', () => { let doc: Document; const TEST_KEY = makeStateKey('test'); + const BOOLEAN_KEY = makeStateKey('boolean'); const DELAYED_KEY = makeStateKey('delayed'); beforeEach(() => { @@ -80,9 +81,9 @@ describe('TransferState', () => { it('supports setting and accessing value \'false\' via get', () => { const transferState: TransferState = TestBed.inject(TransferState); - transferState.set(TEST_KEY, false); - expect(transferState.get(TEST_KEY, true)).toBe(false); - expect(transferState.hasKey(TEST_KEY)).toBe(true); + transferState.set(BOOLEAN_KEY, false); + expect(transferState.get(BOOLEAN_KEY, true)).toBe(false); + expect(transferState.hasKey(BOOLEAN_KEY)).toBe(true); }); it('supports setting and accessing value \'null\' via get', () => { diff --git a/packages/platform-server/package.json b/packages/platform-server/package.json index e6e0eda4b0..3ac0c3fcef 100644 --- a/packages/platform-server/package.json +++ b/packages/platform-server/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "domino": "^2.1.2", - "tslib": "^2.0.0", + "tslib": "^2.1.0", "xhr2": "^0.2.0" }, "repository": { diff --git a/packages/router/package.json b/packages/router/package.json index 10fdb4b680..0dbf4e1922 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -18,7 +18,7 @@ }, "homepage": "https://github.com/angular/angular/tree/master/packages/router", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "@angular/core": "0.0.0-PLACEHOLDER", diff --git a/packages/service-worker/package.json b/packages/service-worker/package.json index 79c9aec93a..9619220e51 100644 --- a/packages/service-worker/package.json +++ b/packages/service-worker/package.json @@ -5,7 +5,7 @@ "author": "angular", "license": "MIT", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "@angular/core": "0.0.0-PLACEHOLDER", diff --git a/packages/upgrade/package.json b/packages/upgrade/package.json index aa2693c933..243018f290 100644 --- a/packages/upgrade/package.json +++ b/packages/upgrade/package.json @@ -5,7 +5,7 @@ "author": "angular", "license": "MIT", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "peerDependencies": { "@angular/core": "0.0.0-PLACEHOLDER", diff --git a/packages/zone.js/package.json b/packages/zone.js/package.json index affbc8fe9e..634d141e0c 100644 --- a/packages/zone.js/package.json +++ b/packages/zone.js/package.json @@ -8,7 +8,7 @@ "fesm2015": "./fesm2015/zone.js", "typings": "./zone.d.ts", "dependencies": { - "tslib": "^2.0.0" + "tslib": "^2.1.0" }, "devDependencies": { "@externs/nodejs": "^1.5.0", @@ -19,7 +19,7 @@ "mocha": "^3.1.2", "mock-require": "3.0.3", "promises-aplus-tests": "^2.1.2", - "typescript": "4.1.2" + "typescript": "4.2.3" }, "scripts": { "closuretest": "./scripts/closure/closure_compiler.sh", diff --git a/packages/zone.js/test/browser/FileReader.spec.ts b/packages/zone.js/test/browser/FileReader.spec.ts index 8789476784..8f409d197c 100644 --- a/packages/zone.js/test/browser/FileReader.spec.ts +++ b/packages/zone.js/test/browser/FileReader.spec.ts @@ -17,8 +17,8 @@ describe('FileReader', ifEnvSupports('FileReader', function() { // Android 4.3's native browser doesn't implement add/RemoveEventListener for FileReader function supportsEventTargetFns() { - return FileReader.prototype.addEventListener && - FileReader.prototype.removeEventListener; + return !!FileReader.prototype.addEventListener && + !!FileReader.prototype.removeEventListener; } (supportsEventTargetFns).message = 'FileReader#addEventListener and FileReader#removeEventListener'; diff --git a/packages/zone.js/test/typings/package.json b/packages/zone.js/test/typings/package.json index 76163fbb18..ec79b4ff5c 100644 --- a/packages/zone.js/test/typings/package.json +++ b/packages/zone.js/test/typings/package.json @@ -14,6 +14,6 @@ "zone.js": "file:../../../../dist/bin/packages/zone.js/npm_package" }, "devDependencies": { - "typescript": "~4.1.2" + "typescript": "~4.2.3" } } diff --git a/packages/zone.js/yarn.lock b/packages/zone.js/yarn.lock index 8ef9211599..cb8ce9a214 100644 --- a/packages/zone.js/yarn.lock +++ b/packages/zone.js/yarn.lock @@ -3745,10 +3745,10 @@ tr46@^2.0.2: dependencies: punycode "^2.1.1" -tslib@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e" - integrity sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ== +tslib@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" + integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== tunnel-agent@^0.6.0: version "0.6.0" @@ -3786,10 +3786,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9" - integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ== +typescript@4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" + integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== underscore@~1.8.3: version "1.8.3" diff --git a/tools/ts-api-guardian/package.json b/tools/ts-api-guardian/package.json index 3ebd078447..06250eba2a 100644 --- a/tools/ts-api-guardian/package.json +++ b/tools/ts-api-guardian/package.json @@ -27,7 +27,7 @@ "chai": "^4.1.2", "jasmine": "^3.1.0", "source-map-support": "^0.5.9", - "typescript": "4.1.2" + "typescript": "4.2.3" }, "keywords": [ "typescript" diff --git a/yarn.lock b/yarn.lock index 7efed1b6b2..e712005173 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15262,10 +15262,10 @@ tslib@^1.13.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== -tslib@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.0.tgz#18d13fc2dce04051e20f074cc8387fd8089ce4f3" - integrity sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g== +tslib@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" + integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== tslint-eslint-rules@5.4.0: version "5.4.0" @@ -15445,10 +15445,10 @@ typescript@~3.7.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== -typescript@~4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9" - integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ== +typescript@~4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" + integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== uglify-js@^1.3.3: version "1.3.5"