10000 feat(core): support TypeScript 4.4 by crisbeto · Pull Request #43281 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content

feat(core): support TypeScript 4.4 #43281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aio/aio-builds-setup/dockerbuild/scripts-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"shelljs": "^0.8.4",
"source-map-support": "^0.5.19",
"tar-stream": "^2.1.3",
"tslib": "^2.2.0"
"tslib": "^2.3.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.3.4"
"typescript": "~4.4.2"
}
}
1 change: 1 addition & 0 deletions aio/aio-builds-setup/dockerbuild/scripts-js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"noUnusedParameters": true, /* Report errors on unused parameters. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
"useUnknownInCatchVariables": false, /* Avoid having to cast error objects inside `catch` clauses. */

/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
Expand Down
16 changes: 8 additions & 8 deletions aio/aio-builds-setup/dockerbuild/scripts-js/yarn.lock
Original file line number Diff line number Diff line change
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.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==
tslib@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==

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.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.4.tgz#3f85b986945bcf31071decdd96cf8bfa65f9dcbc"
integrity sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==
typescript@~4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86"
integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==

undefsafe@^2.0.2:
version "2.0.2"
Expand Down
4 changes: 2 additions & 2 deletions aio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"@webcomponents/custom-elements": "1.5.0",
"rxjs": "^6.6.7",
"safevalues": "^0.1.8",
"tslib": "^2.2.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
Expand Down Expand Up @@ -181,7 +181,7 @@
"ts-node": "^10.0.0",
"tsec": "^0.1.5",
"tslint": "~6.1.3",
"typescript": "~4.3.4",
"typescript": "~4.4.2",
"uglify-js": "^3.13.3",
"unist-util-filter": "^2.0.3",
"unist-util-source": "^3.0.0",
Expand Down
1 change: 1 addition & 0 deletions aio/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"useUnknownInCatchVariables": false,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
Expand Down
10 changes: 5 additions & 5 deletions aio/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12778,7 +12778,7 @@ tslib@^1.10.0, tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2.0.0, tslib@^2.0.1, tslib@^2.2.0:
tslib@^2.0.0, tslib@^2.0.1, tslib@^2.2.0, tslib@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
Expand Down Expand Up @@ -12917,10 +12917,10 @@ typescript@~3.2.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.4.tgz#c585cb952912263d915b462726ce244ba510ef3d"
integrity sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg==

typescript@~4.3.4:
version "4.3.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
typescript@~4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86"
integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==

ua-parser-js@^0.7.28:
version "0.7.28"
Expand Down
6 changes: 6 additions & 0 deletions integration/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ INTEGRATION_TESTS = {
# root @npm//typescript package.
"pinned_npm_packages": ["typescript"],
},
"typings_test_ts44": {
# Special case for `typings_test_ts44` test as we want to pin
# `typescript` at version 4.4.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_ts44/include-all.ts
Original file line number Diff line number Diff line change
@@ -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_ts44/package.json
F438
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "angular-integration",
"description": "Assert that users with TypeScript 4.4 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.4.2",
"zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz"
},
"scripts": {
"test": "tsc"
}
}
26 changes: 26 additions & 0 deletions integration/typings_test_ts44/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@
"terser": "^4.4.0",
"tmp": "0.2.1",
"tsickle": "0.38.1",
"tslib": "^2.2.0",
"tslib": "^2.3.0",
"tslint": "6.1.3",
"typescript": "~4.3.4",
"ty 10000 pescript": "~4.4.2",
"xhr2": "0.2.1",
"yargs": "^17.0.0"
},
Expand Down Expand Up @@ -191,6 +191,7 @@
"// 4": "Overwrite graceful-fs to a version that does not rely on the 'natives' package. This fixes gulp for >= 10.13, more information: #28213",
"// 5": "Ensure a single version of webdriver-manager so it is hoisted as the integration tests depend on it being found at ../../node_modules/webdriver-manager",
"// 6": "Ensure that `@babel/*` packages match the below versions to avoid conflicts with `types/babel__*`",
"// 7": "TypeScript has to be resolved to 4.4 temporarily until @microsoft/api-extractor is updated",
"resolutions": {
"**/graceful-fs": "4.2.8",
"**/webdriver-manager": "12.1.8",
Expand All @@ -200,6 +201,7 @@
"@babel/preset-env": "7.10.2",
"@babel/template": "7.8.6",
"@babel/traverse": "7.8.6",
"@babel/types": "7.8.6"
"@babel/types": "7.8.6",
"typescript": "4.4.2"
}
}
2 changes: 1 addition & 1 deletion packages/animations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"node": "^12.14.1 || >=14.0.0"
},
"dependencies": {
"tslib": "^2.2.0"
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/core": "0.0.0-PLACEHOLDER"
Expand Down
4 changes: 2 additions & 2 deletions packages/bazel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"@microsoft/api-extractor": "7.18.7",
"shelljs": "0.8.4",
"tsickle": "^0.38.0",
"tslib": "^2.2.0"
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
"@bazel/typescript": ">=1.0.0",
"terser": "^4.3.1",
"typescript": ">=4.2.3 <4.4",
"typescript": ">=4.2.3 <4.5",
"rollup": ">=1.20.0",
"rollup-plugin-commonjs": ">=9.0.0",
"rollup-plugin-node-resolve": ">=4.2.0",
Expand Down
1 change: 0 additions & 1 deletion packages/benchpress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "Benchpress - a framework for e2e performance tests",
"main": "index.js",
"typings": "./index.d.ts",
"strictNullChecks": true,
"dependencies": {
"@angular/core": "^12.0.0",
"reflect-metadata": "^0.1.13"
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"locales": "locales",
"dependencies": {
"tslib": "^2.2.0"
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/core": "0.0.0-PLACEHOLDER",
Expand Down
5 changes: 3 additions & 2 deletions packages/compiler-cli/ngcc/src/host/esm5_host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost {
*
* 1. `__spread(arguments)`
* 2. `__spreadArray([], __read(arguments))`
* 3. `__spreadArray([], __read(arguments), false)`
*
* The tslib helpers may have been emitted inline as in the above example, or they may be read
* from a namespace import.
Expand All @@ -587,8 +588,8 @@ export class Esm5ReflectionHost extends Esm2015ReflectionHost {
// `__spread(arguments)`
return call.args.length === 1 && isArgumentsIdentifier(call.args[0]);
} else if (call.helper === KnownDeclaration.TsHelperSpreadArray) {
// `__spreadArray([], __read(arguments))`
if (call.args.length !== 2) {
// `__spreadArray([], __read(arguments), false)`
if (call.args.length !== 2 && call.args.length !== 3) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-cli/ngcc/test/integration/ngcc_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ runInEachFileSystem(() => {

const jsContents = fs.readFile(_(`/node_modules/test-package/esm5/src/index.js`));
// Verify that the ES5 bundle does contain the expected downleveling syntax.
expect(jsContents).toContain('__spreadArray([], __read(arguments))');
expect(jsContents).toContain('__spreadArray([], __read(arguments), false)');
expect(jsContents)
.toContain(
'var ɵSubClass_BaseFactory; return function SubClass_Factory(t) { return (ɵSubClass_BaseFactory || (ɵSubClass_BaseFactory = ɵngcc0.ɵɵgetInheritedFactory(SubClass)))(t || SubClass); };');
Expand Down Expand Up @@ -420,7 +420,7 @@ runInEachFileSystem(() => {

const jsContents = fs.readFile(_(`/node_modules/test-package/esm5/src/index.js`));
// Verify that the ES5 bundle does contain the expected downleveling syntax.
expect(jsContents).toContain('__spreadArray([], __read(arguments))');
expect(jsContents).toContain('__spreadArray([], __read(arguments), false)');
expect(jsContents)
.toContain(
'var ɵSubClass_BaseFactory; return function SubClass_Factory(t) { return (ɵSubClass_BaseFactory || (ɵSubClass_BaseFactory = ɵngcc0.ɵɵgetInheritedFactory(SubClass)))(t || SubClass); };');
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"semver": "^7.0.0",
"source-map": "^0.6.1",
"sourcemap-codec": "^1.4.8",
"tslib": "^2.2.0",
"tslib": "^2.3.0",
"yargs": "^17.0.0"
},
"peerDependencies": {
"@angular/compiler": "0.0.0-PLACEHOLDER",
"typescript": ">=4.2.3 <4.4"
"typescript": ">=4.2.3 <4.5"
},
"repository": {
"type": "git",
Expand Down
Loading
0