Skip to content

Commit f33210c

Browse files
authored
feat: add support for TypeScript 4.0 (#20368)
With this change we refactor the code to support compilation using TS 4.0. 1) Refactor tests to not delete non optional properties 2) Refactor components not to override properties with accessors and vice-versa which is now not permitted. https://devblogs.microsoft.com/typescript/announcing-typescript-4-0-beta/#breaking-changes 3) update typescript to 4.0, tslint to 6.1.3 and angular packages to 10.1.0-next.8 4) add ts-compat integration test for TypeScript 3.9
1 parent 6103b74 commit f33210c

File tree

44 files changed

+395
-266
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

+395
-266
lines changed

integration/ts-compat/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ write_file(
1313
# List of TypeScript packages that we want to run the compatibility test against.
1414
# The list contains NPM module names that resolve to the desired TypeScript version.
1515
typescript_version_packages = [
16+
"typescript-3.9",
1617
"typescript",
1718
]
1819

package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@
4949
},
5050
"version": "10.2.0-next.0",
5151
"dependencies": {
52-
"@angular/animations": "^10.0.8",
53-
"@angular/common": "^10.0.8",
54-
"@angular/compiler": "^10.0.8",
55-
"@angular/core": "^10.0.8",
56-
"@angular/elements": "^10.0.8",
57-
"@angular/forms": "^10.0.8",
58-
"@angular/platform-browser": "^10.0.8",
52+
"@angular/animations": "^10.1.0-next.8",
53+
"@angular/common": "^10.1.0-next.8",
54+
"@angular/compiler": "^10.1.0-next.8",
55+
"@angular/core": "^10.1.0-next.8",
56+
"@angular/elements": "^10.1.0-next.8",
57+
"@angular/forms": "^10.1.0-next.8",
58+
"@angular/platform-browser": "^10.1.0-next.8",
5959
"@types/googlemaps": "^3.39.3",
6060
"@types/youtube": "^0.0.38",
6161
"@webcomponents/custom-elements": "^1.1.0",
@@ -71,13 +71,13 @@
7171
"@angular-devkit/build-optimizer": "^0.1000.5",
7272
"@angular-devkit/core": "^10.0.5",
7373
"@angular-devkit/schematics": "^10.0.5",
74-
"@angular/bazel": "^10.0.8",
74+
"@angular/bazel": "^10.1.0-next.8",
7575
"@angular/benchpress": "^0.2.1",
76-
"@angular/compiler-cli": "^10.0.8",
76+
"@angular/compiler-cli": "^10.1.0-next.8",
7777
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#d0855af987db4e426477da1780bcd02941c31271",
78-
"@angular/platform-browser-dynamic": "^10.0.8",
79-
"@angular/platform-server": "^10.0.8",
80-
"@angular/router": "^10.0.8",
78+
"@angular/platform-browser-dynamic": "^10.1.0-next.8",
79+
"@angular/platform-server": "^10.1.0-next.8",
80+
"@angular/router": "^10.1.0-next.8",
8181
"@bazel/bazelisk": "^1.4.0",
8282
"@bazel/buildifier": "^2.2.1",
8383
"@bazel/ibazel": "^0.13.0",
@@ -165,14 +165,15 @@
165165
"ts-api-guardian": "^0.5.0",
166166
"ts-node": "^8.10.1",
167167
"tsickle": "0.38.1",
168-
"tslint": "^6.1.0",
168+
"tslint": "^6.1.3",
169169
"tsutils": "^3.17.1",
170-
"typescript": "3.9.7",
170+
"typescript": "4.0.2",
171+
"typescript-3.9": "npm:typescript@~3.9.7",
171172
"vrsource-tslint-rules": "5.1.1",
172173
"yaml": "^1.10.0"
173174
},
174175
"resolutions": {
175-
"dgeni-packages/typescript": "3.9.7",
176+
"dgeni-packages/typescript": "4.0.2",
176177
"**/graceful-fs": "4.2.2"
177178
}
178179
}

src/cdk-experimental/selection/row-selection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class CdkRowSelection<T> {
3131
@Input('cdkRowSelectionIndex')
3232
get index(): number|undefined { return this._index; }
3333
set index(index: number|undefined) { this._index = coerceNumberProperty(index); }
34-
private _index?: number;
34+
protected _index?: number;
3535

3636
constructor(readonly _selection: CdkSelection<T>) {}
3737

src/cdk-experimental/selection/selection-toggle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class CdkSelectionToggle<T> implements OnDestroy, OnInit {
4444
@Input('cdkSelectionToggleIndex')
4545
get index(): number|undefined { return this._index; }
4646
set index(index: number|undefined) { this._index = coerceNumberProperty(index); }
47-
private _index?: number;
47+
protected _index?: number;
4848

4949
/** The checked state of the selection toggle */
5050
readonly checked: Observable<boolean> = this._selection.change.pipe(

src/cdk-experimental/selection/selection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class CdkSelection<T> implements OnInit, AfterContentChecked, CollectionV
5757
set multiple(multiple: boolean) {
5858
this._multiple = coerceBooleanProperty(multiple);
5959
}
60-
private _multiple: boolean;
60+
protected _multiple: boolean;
6161

6262
/** Emits when selection changes. */
6363
@Output('cdkSelectionChange') change = new EventEmitter<SelectionChange<T>>();

0 commit comments

Comments
 (0)