Skip to content

Commit e149ebf

Browse files
clydinthePunderWoman
authored andcommitted
build: update rxjs build version to v7 (angular#53500)
The version of rxjs used to build the repository has been updated to v7. This required only minimal changes to the code. Most of which were type related only due to more strict types in v7. The behavior in those cases was left intact. The most common type related change was to handle the possibility of `undefined` with `toPromise` which was always possible with v6 but the types did not reflect the runtime behavior. The one change that was not type related was to provide a parameter value to the `defaultIfEmpty` operator. It no longer defaults to a value of `null` if no default is provided. To provide the same behavior the value of `null` is now passed to the operator. PR Close angular#53500
1 parent b06b24b commit e149ebf

29 files changed

Lines changed: 1269 additions & 1206 deletions

File tree

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/directive-forest/component-data-source/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export class ComponentDataSource extends DataSource<FlatNode> {
176176
this._treeControl.expansionModel.changed,
177177
this._flattenedData,
178178
];
179-
return merge(...changes)
179+
return merge<unknown[]>(...changes)
180180
.pipe(
181181
map(() => {
182182
this._expandedData.next(

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/property-resolver/property-data-source.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class PropertyDataSource extends DataSource<FlatNode> {
6969
const changes =
7070
[collectionViewer.viewChange, this._treeControl.expansionModel.changed, this._data];
7171

72-
return merge(...changes).pipe(map(() => {
72+
return merge<unknown[]>(...changes).pipe(map(() => {
7373
this._expandedData.next(
7474
this._treeFlattener.expandFlattenedNodes(this.data, this._treeControl));
7575
return this._expandedData.value;

modules/benchmarks/src/expanding_rows/expanding_row_details_caption.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class ExpandingRowDetailsCaption implements OnDestroy {
3535
@Input() color: string = 'blue';
3636

3737
/** This is triggered when this component is destroyed. */
38-
private readonly onDestroy = new Subject();
38+
private readonly onDestroy = new Subject<void>();
3939

4040
/**
4141
* We need a reference to parent cfc-expanding-row component here to hide

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
"rollup": "~2.79.0",
127127
"rollup-plugin-preserve-shebang": "^1.0.1",
128128
"rollup-plugin-sourcemaps": "^0.6.3",
129-
"rxjs": "^6.6.7",
129+
"rxjs": "^7.0.0",
130130
"selenium-webdriver": "3.5.0",
131131
"selenium-webdriver4": "npm:selenium-webdriver@4.14.0",
132132
"semver-dsl": "^1.0.1",

packages/common/http/test/client_spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ describe('HttpClient', () => {
106106
});
107107
it('that returns a stream of events', done => {
108108
client.get('/test', {observe: 'events'}).pipe(toArray()).toPromise().then(events => {
109-
expect(events.length).toBe(2);
109+
expect(events!.length).toBe(2);
110110
let x = HttpResponse;
111-
expect(events[0].type).toBe(HttpEventType.Sent);
112-
expect(events[1].type).toBe(HttpEventType.Response);
113-
expect(events[1] instanceof HttpResponse).toBeTruthy();
111+
expect(events![0].type).toBe(HttpEventType.Sent);
112+
expect(events![1].type).toBe(HttpEventType.Response);
113+
expect(events![1] instanceof HttpResponse).toBeTruthy();
114114
done();
115115
});
116116
backend.expectOne('/test').flush({'data': 'hello world'});

packages/common/http/test/fetch_spec.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ import {HttpDownloadProgressEvent, HttpErrorResponse, HttpHeaderResponse, HttpPa
1515
import {FetchBackend, FetchFactory} from '../src/fetch';
1616

1717
function trackEvents(obs: Observable<any>): Promise<any[]> {
18-
return obs
19-
.pipe(
20-
// We don't want the promise to fail on HttpErrorResponse
21-
catchError((e) => of(e)),
22-
scan(
23-
(acc, event) => {
24-
acc.push(event);
25-
return acc;
26-
},
27-
[] as any[]),
28-
)
29-
.toPromise();
18+
return obs.pipe(
19+
// We don't want the promise to fail on HttpErrorResponse
20+
catchError((e) => of(e)),
21+
scan(
22+
(acc, event) => {
23+
acc.push(event);
24+
return acc;
25+
},
26+
[] as any[]),
27+
)
28+
.toPromise() as Promise<any[]>;
3029
}
3130

3231
const TEST_POST = new HttpRequest('POST', '/test', 'some body', {

packages/core/src/event_emitter.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
/// <reference types="rxjs" />
10-
119
import {PartialObserver, Subject, Subscription} from 'rxjs';
1210

1311
/**

packages/core/test/acceptance/initial_render_pending_tasks_spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ describe('InitialRenderPendingTasks', () => {
5353

5454
function hasPendingTasks(pendingTasks: InitialRenderPendingTasks): Promise<boolean> {
5555
return of(EMPTY)
56-
.pipe(
57-
withLatestFrom(pendingTasks.hasPendingTasks),
58-
map(([_, hasPendingTasks]) => hasPendingTasks),
59-
)
60-
.toPromise();
56+
.pipe(
57+
withLatestFrom(pendingTasks.hasPendingTasks),
58+
map(([_, hasPendingTasks]) => hasPendingTasks),
59+
)
60+
.toPromise() as Promise<boolean>;
6161
}

packages/core/test/acceptance/outputs_spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import {TestBed} from '@angular/core/testing';
1313
describe('outputs', () => {
1414
@Component({selector: 'button-toggle', template: ''})
1515
class ButtonToggle {
16-
@Output('change') change = new EventEmitter();
16+
@Output('change') change = new EventEmitter<void>();
1717

18-
@Output('reset') resetStream = new EventEmitter();
18+
@Output('reset') resetStream = new EventEmitter<void>();
1919
}
2020

2121
@Directive({selector: '[otherDir]'})
2222
class OtherDir {
23-
@Output('change') changeStream = new EventEmitter();
23+
@Output('change') changeStream = new EventEmitter<void>();
2424
}
2525

2626
@Component({selector: 'destroy-comp', template: ''})
@@ -33,7 +33,7 @@ describe('outputs', () => {
3333

3434
@Directive({selector: '[myButton]'})
3535
class MyButton {
36-
@Output() click = new EventEmitter();
36+
@Output() click = new EventEmitter<void>();
3737
}
3838

3939
it('should call component output function when event is emitted', () => {

packages/core/test/acceptance/property_binding_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ describe('property bindings', () => {
396396
class MyDir {
397397
@Input() role: string|undefined;
398398
@Input('dir') direction: string|undefined;
399-
@Output('change') changeStream = new EventEmitter();
399+
@Output('change') changeStream = new EventEmitter<void>();
400400
}
401401

402402
@Directive({selector: '[myDirB]'})

0 commit comments

Comments
 (0)