Skip to content

Commit

Permalink
feat(core): support TypeScript 4.2 (#41158)
Browse files Browse the repository at this point in the history
Updates the repo to TypeScript 4.2 and tslib 2.1.0.

PR Close #41158
  • Loading branch information
crisbeto authored and thePunderWoman committed Mar 17, 2021
1 parent eb74a96 commit 59ef409
Show file tree
Hide file tree
Showing 44 changed files with 283 additions and 134 deletions.
4 changes: 2 additions & 2 deletions aio/aio-builds-setup/dockerbuild/scripts-js/package.json
Expand Up @@ -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",
Expand All @@ -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"
}
}
16 changes: 8 additions & 8 deletions aio/aio-builds-setup/dockerbuild/scripts-js/yarn.lock
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
@@ -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', () => {
Expand Down Expand Up @@ -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<void>(res => {
jsonp('localhost:8080/jsonp', () => {
// success callback and resolve the promise
finished = true;
Expand Down
4 changes: 2 additions & 2 deletions aio/package.json
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions aio/yarn.lock
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions dev-infra/build-worker.js
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions dev-infra/ng-dev.js
Expand Up @@ -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',
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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),
Expand All @@ -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({
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}());
Expand Down
6 changes: 6 additions & 0 deletions integration/BUILD.bazel
Expand Up @@ -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"],
},
}

[
Expand Down
69 changes: 69 additions & 0 deletions 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,
};
28 changes: 28 additions & 0 deletions 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"
}
}
26 changes: 26 additions & 0 deletions 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"
]
}
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/package.json
Expand Up @@ -5,7 +5,7 @@
"author": "angular",
"license": "MIT",
"dependencies": {
"tslib": "^2.0.0"
"tslib": "^2.1.0"
},
"peerDependencies": {
"@angular/core": "0.0.0-PLACEHOLDER"
Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/package.json
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"locales": "locales",
"dependencies": {
"tslib": "^2.0.0"
"tslib": "^2.1.0"
},
"peerDependencies": {
"@angular/core": "0.0.0-PLACEHOLDER",
Expand Down

0 comments on commit 59ef409

Please sign in to comment.