Skip to content

Commit 59ef409

Browse files
crisbetothePunderWoman
authored andcommitted
feat(core): support TypeScript 4.2 (angular#41158)
Updates the repo to TypeScript 4.2 and tslib 2.1.0. PR Close angular#41158
1 parent eb74a96 commit 59ef409

File tree

44 files changed

+283
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+283
-134
lines changed

aio/aio-builds-setup/dockerbuild/scripts-js/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"shelljs": "^0.8.4",
3434
"source-map-support": "^0.5.19",
3535
"tar-stream": "^2.1.3",
36-
"tslib": "^2.0.1"
36+
"tslib": "^2.1.0"
3737
},
3838
"devDependencies": {
3939
"@types/body-parser": "^1.19.0",
@@ -49,6 +49,6 @@
4949
"supertest": "^4.0.2",
5050
"tslint": "^6.1.3",
5151
"tslint-jasmine-noSkipOrFocus": "^1.0.9",
52-
"typescript": "^4.1.2"
52+
"typescript": "^4.2.3"
5353
}
5454
}

aio/aio-builds-setup/dockerbuild/scripts-js/yarn.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,10 +2505,10 @@ tslib@^1.8.1:
25052505
version "1.9.3"
25062506
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
25072507

2508-
tslib@^2.0.1:
2509-
version "2.0.1"
2510-
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e"
2511-
integrity sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==
2508+
tslib@^2.1.0:
2509+
version "2.1.0"
2510+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
2511+
integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==
25122512

25132513
tslint-jasmine-noSkipOrFocus@^1.0.9:
25142514
version "1.0.9"
@@ -2563,10 +2563,10 @@ typedarray-to-buffer@^3.1.5:
25632563
dependencies:
25642564
is-typedarray "^1.0.0"
25652565

2566-
typescript@^4.1.2:
2567-
version "4.1.2"
2568-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9"
2569-
integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==
2566+
typescript@^4.2.3:
2567+
version "4.2.3"
2568+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
2569+
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
25702570

25712571
undefsafe@^2.0.2:
25722572
version "2.0.2"

aio/content/examples/testing/src/app/demo/async-helper.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// tslint:disable-next-line:no-unused-variable
2-
import { fakeAsync, tick, waitForAsync } from '@angular/core/testing';
3-
import { interval, of } from 'rxjs';
4-
import { delay, take } from 'rxjs/operators';
2+
import {fakeAsync, tick, waitForAsync} from '@angular/core/testing';
3+
import {interval, of} from 'rxjs';
4+
import {delay, take} from 'rxjs/operators';
55

66
describe('Angular async helper', () => {
77
describe('async', () => {
@@ -183,7 +183,7 @@ describe('Angular async helper', () => {
183183
// before loading zone.js/testing
184184
it('should wait until promise.then is called', waitForAsync(() => {
185185
let finished = false;
186-
new Promise((res, rej) => {
186+
new Promise<void>(res => {
187187
jsonp('localhost:8080/jsonp', () => {
188188
// success callback and resolve the promise
189189
finished = true;

aio/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"@angular/service-worker": "11.2.3",
105105
"@webcomponents/custom-elements": "1.2.1",
106106
"rxjs": "^6.5.3",
107-
"tslib": "^2.0.0",
107+
"tslib": "^2.1.0",
108108
"zone.js": "~0.11.4"
109109
},
110110
"devDependencies": {
@@ -170,7 +170,7 @@
170170
"tree-kill": "^1.1.0",
171171
"ts-node": "^8.4.1",
172172
"tslint": "~6.1.0",
173-
"typescript": "~4.1.2",
173+
"typescript": "~4.2.3",
174174
"uglify-js": "^3.0.15",
175175
"unist-util-filter": "^0.2.1",
176176
"unist-util-source": "^1.0.1",

aio/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13722,10 +13722,10 @@ typescript@^3.2.2:
1372213722
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae"
1372313723
integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==
1372413724

13725-
typescript@~4.1.2:
13726-
version "4.1.5"
13727-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72"
13728-
integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==
13725+
typescript@~4.2.3:
13726+
version "4.2.3"
13727+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
13728+
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
1372913729

1373013730
ua-parser-js@^0.7.23:
1373113731
version "0.7.24"

dev-infra/build-worker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function buildLogLevelFunction(loadCommand, level) {
5858
for (var _i = 0; _i < arguments.length; _i++) {
5959
text[_i] = arguments[_i];
6060
}
61-
runConsoleCommand.apply(void 0, tslib.__spread([loadCommand, level], text));
61+
runConsoleCommand.apply(void 0, tslib.__spreadArray([loadCommand, level], tslib.__read(text)));
6262
};
6363
/** Start a group at the LOG_LEVEL, optionally starting it as collapsed. */
6464
loggingFunction.group = function (text, collapsed) {
@@ -87,9 +87,9 @@ function runConsoleCommand(loadCommand, logLevel) {
8787
text[_i - 2] = arguments[_i];
8888
}
8989
if (getLogLevel() >= logLevel) {
90-
loadCommand().apply(void 0, tslib.__spread(text));
90+
loadCommand().apply(void 0, tslib.__spreadArray([], tslib.__read(text)));
9191
}
92-
printToLogFile.apply(void 0, tslib.__spread([logLevel], text));
92+
printToLogFile.apply(void 0, tslib.__spreadArray([logLevel], tslib.__read(text)));
9393
}
9494
/**
9595
* Retrieve the log level from environment variables, if the value found

dev-infra/ng-dev.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ function promptAutocomplete(message, choices, noChoiceText) {
239239
case 0:
240240
prompt = inquirer.createPromptModule({}).registerPrompt('autocomplete', inquirerAutocomplete);
241241
if (noChoiceText) {
242-
choices = tslib.__spread([noChoiceText], choices);
242+
choices = tslib.__spreadArray([noChoiceText], tslib.__read(choices));
243243
}
244244
return [4 /*yield*/, prompt({
245245
type: 'autocomplete',
@@ -313,7 +313,7 @@ function buildLogLevelFunction(loadCommand, level) {
313313
for (var _i = 0; _i < arguments.length; _i++) {
314314
text[_i] = arguments[_i];
315315
}
316-
runConsoleCommand.apply(void 0, tslib.__spread([loadCommand, level], text));
316+
runConsoleCommand.apply(void 0, tslib.__spreadArray([loadCommand, level], tslib.__read(text)));
317317
};
318318
/** Start a group at the LOG_LEVEL, optionally starting it as collapsed. */
319319
loggingFunction.group = function (text, collapsed) {
@@ -342,9 +342,9 @@ function runConsoleCommand(loadCommand, logLevel) {
342342
text[_i - 2] = arguments[_i];
343343
}
344344
if (getLogLevel() >= logLevel) {
345-
loadCommand().apply(void 0, tslib.__spread(text));
345+
loadCommand().apply(void 0, tslib.__spreadArray([], tslib.__read(text)));
346346
}
347-
printToLogFile.apply(void 0, tslib.__spread([logLevel], text));
347+
printToLogFile.apply(void 0, tslib.__spreadArray([logLevel], tslib.__read(text)));
348348
}
349349
/**
350350
* Retrieve the log level from environment variables, if the value found
@@ -2254,7 +2254,7 @@ function allChangedFilesSince(sha) {
22542254
var diffFiles = gitOutputAsArray("git diff --name-only --diff-filter=d " + sha);
22552255
var untrackedFiles = gitOutputAsArray("git ls-files --others --exclude-standard");
22562256
// Use a set to deduplicate the list as its possible for a file to show up in both lists.
2257-
return Array.from(new Set(tslib.__spread(diffFiles, untrackedFiles)));
2257+
return Array.from(new Set(tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(diffFiles)), tslib.__read(untrackedFiles))));
22582258
}
22592259
/**
22602260
* A list of all staged files which have been modified.
@@ -2947,7 +2947,7 @@ function getPr(prSchema, prNumber, git) {
29472947
PR_QUERY = typedGraphqlify.params({
29482948
$number: 'Int!',
29492949
$owner: 'String!',
2950-
$name: 'String!',
2950+
$name: 'String!', // The organization to query for
29512951
}, {
29522952
repository: typedGraphqlify.params({ owner: '$owner', name: '$name' }, {
29532953
pullRequest: typedGraphqlify.params({ number: '$number' }, prSchema),
@@ -2973,7 +2973,7 @@ function getPendingPrs(prSchema, git) {
29732973
$first: 'Int',
29742974
$after: 'String',
29752975
$owner: 'String!',
2976-
$name: 'String!',
2976+
$name: 'String!', // The repository to query for
29772977
}, {
29782978
repository: typedGraphqlify.params({ owner: '$owner', name: '$name' }, {
29792979
pullRequests: typedGraphqlify.params({
@@ -3003,7 +3003,7 @@ function getPendingPrs(prSchema, git) {
30033003
return [4 /*yield*/, git.github.graphql.query(PRS_QUERY, params_1)];
30043004
case 2:
30053005
results = _b.sent();
3006-
prs.push.apply(prs, tslib.__spread(results.repository.pullRequests.nodes));
3006+
prs.push.apply(prs, tslib.__spreadArray([], tslib.__read(results.repository.pullRequests.nodes)));
30073007
hasNextPage = results.repository.pullRequests.pageInfo.hasNextPage;
30083008
cursor = results.repository.pullRequests.pageInfo.endCursor;
30093009
return [3 /*break*/, 1];
@@ -3598,7 +3598,7 @@ var MergeStrategy = /** @class */ (function () {
35983598
// Checkout the local target branch.
35993599
this.git.run(['checkout', localTargetBranch]);
36003600
// Cherry-pick the refspec into the target branch.
3601-
if (this.git.runGraceful(tslib.__spread(['cherry-pick'], cherryPickArgs)).status !== 0) {
3601+
if (this.git.runGraceful(tslib.__spreadArray(['cherry-pick'], tslib.__read(cherryPickArgs))).status !== 0) {
36023602
// Abort the failed cherry-pick. We do this because Git persists the failed
36033603
// cherry-pick state globally in the repository. This could prevent future
36043604
// pull request merges as a Git thinks a cherry-pick is still in progress.
@@ -3637,7 +3637,7 @@ var MergeStrategy = /** @class */ (function () {
36373637
});
36383638
// Fetch all target branches with a single command. We don't want to fetch them
36393639
// individually as that could cause an unnecessary slow-down.
3640-
this.git.run(tslib.__spread(['fetch', '-q', '-f', this.git.repoGitUrl], fetchRefspecs, extraRefspecs));
3640+
this.git.run(tslib.__spreadArray(tslib.__spreadArray(['fetch', '-q', '-f', this.git.repoGitUrl], tslib.__read(fetchRefspecs)), tslib.__read(extraRefspecs)));
36413641
};
36423642
/** Pushes the given target branches upstream. */
36433643
MergeStrategy.prototype.pushTargetBranchesUpstream = function (names) {
@@ -3648,7 +3648,7 @@ var MergeStrategy = /** @class */ (function () {
36483648
});
36493649
// Push all target branches with a single command if we don't run in dry-run mode.
36503650
// We don't want to push them individually as that could cause an unnecessary slow-down.
3651-
this.git.run(tslib.__spread(['push', this.git.repoGitUrl], pushRefspecs));
3651+
this.git.run(tslib.__spreadArray(['push', this.git.repoGitUrl], tslib.__read(pushRefspecs)));
36523652
};
36533653
return MergeStrategy;
36543654
}());

integration/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ INTEGRATION_TESTS = {
9797
# root @npm//typescript package.
9898
"pinned_npm_packages": ["typescript"],
9999
},
100+
"typings_test_ts42": {
101+
# Special case for `typings_test_ts42` test as we want to pin
102+
# `typescript` at version 4.2.x for that test and not link to the
103+
# root @npm//typescript package.
104+
"pinned_npm_packages": ["typescript"],
105+
},
100106
}
101107

102108
[
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
10+
11+
import * as animations from '@angular/animations';
12+
import * as animationsBrowser from '@angular/animations/browser';
13+
import * as animationsBrowserTesting from '@angular/animations/browser/testing';
14+
import * as common from '@angular/common';
15+
import * as commonHttp from '@angular/common/http';
16+
import * as commonTesting from '@angular/common/testing';
17+
import * as commonHttpTesting from '@angular/common/testing';
18+
import * as compiler from '@angular/compiler';
19+
import * as compilerTesting from '@angular/compiler/testing';
20+
import * as core from '@angular/core';
21+
import * as coreTesting from '@angular/core/testing';
22+
import * as elements from '@angular/elements';
23+
import * as forms from '@angular/forms';
24+
import * as platformBrowser from '@angular/platform-browser';
25+
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
26+
import * as platformBrowserDynamicTesting from '@angular/platform-browser-dynamic/testing';
27+
import * as platformBrowserAnimations from '@angular/platform-browser/animations';
28+
import * as platformBrowserTesting from '@angular/platform-browser/testing';
29+
import * as platformServer from '@angular/platform-server';
30+
import * as platformServerInit from '@angular/platform-server/init';
31+
import * as platformServerTesting from '@angular/platform-server/testing';
32+
import * as router from '@angular/router';
33+
import * as routerTesting from '@angular/router/testing';
34+
import * as routerUpgrade from '@angular/router/upgrade';
35+
import * as serviceWorker from '@angular/service-worker';
36+
import * as upgrade from '@angular/upgrade';
37+
import * as upgradeStatic from '@angular/upgrade/static';
38+
import * as upgradeTesting from '@angular/upgrade/static/testing';
39+
40+
export default {
41+
animations,
42+
animationsBrowser,
43+
animationsBrowserTesting,
44+
common,
45+
commonTesting,
46+
commonHttp,
47+
commonHttpTesting,
48+
compiler,
49+
compilerTesting,
50+
core,
51+
coreTesting,
52+
elements,
53+
forms,
54+
platformBrowser,
55+
platformBrowserTesting,
56+
platformBrowserDynamic,
57+
platformBrowserDynamicTesting,
58+
platformBrowserAnimations,
59+
platformServer,
60+
platformServerInit,
61+
platformServerTesting,
62+
router,
63+
routerTesting,
64+
routerUpgrade,
65+
serviceWorker,
66+
upgrade,
67+
upgradeStatic,
68+
upgradeTesting,
69+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "angular-integration",
3+
"description": "Assert that users with TypeScript 4.2 can type-check an Angular application",
4+
"version": "0.0.0",
5+
"license": "MIT",
6+
"dependencies": {
7+
"@angular/animations": "file:../../dist/packages-dist/animations",
8+
"@angular/common": "file:../../dist/packages-dist/common",
9+
"@angular/compiler": "file:../../dist/packages-dist/compiler",
10+
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
11+
"@angular/core": "file:../../dist/packages-dist/core",
12+
"@angular/elements": "file:../../dist/packages-dist/elements",
13+
"@angular/forms": "file:../../dist/packages-dist/forms",
14+
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
15+
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
16+
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
17+
"@angular/router": "file:../../dist/packages-dist/router",
18+
"@angular/service-worker": "file:../../dist/packages-dist/service-worker",
19+
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
20+
"@types/jasmine": "file:../../node_modules/@types/jasmine",
21+
"rxjs": "file:../../node_modules/rxjs",
22+
"typescript": "4.2.3",
23+
"zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz"
24+
},
25+
"scripts": {
26+
"test": "tsc"
27+
}
28+
}

0 commit comments

Comments
 (0)