Skip to content

Commit bea96c7

Browse files
committed
Fix TS 2.7 error
1 parent 742723a commit bea96c7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/lib/table/table-data-source.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
import {DataSource} from '@angular/cdk/table';
1010
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
11-
import {MatPaginator} from '@angular/material/paginator';
12-
import {MatSort} from '@angular/material/sort';
11+
import {Observable} from 'rxjs/Observable';
12+
import {MatPaginator, PageEvent} from '@angular/material/paginator';
13+
import {MatSort, Sort} from '@angular/material/sort';
1314
import {Subscription} from 'rxjs/Subscription';
1415
import {combineLatest} from 'rxjs/operators/combineLatest';
1516
import {map} from 'rxjs/operators/map';
@@ -178,8 +179,9 @@ export class MatTableDataSource<T> extends DataSource<T> {
178179
_updateChangeSubscription() {
179180
// Sorting and/or pagination should be watched if MatSort and/or MatPaginator are provided.
180181
// Otherwise, use an empty observable stream to take their place.
181-
const sortChange = this._sort ? this._sort.sortChange : empty();
182-
const pageChange = this._paginator ? this._paginator.page : empty();
182+
const sortChange = (this._sort ? this._sort.sortChange : empty()) as Observable<Sort | null>;
183+
const pageChange =
184+
(this._paginator ? this._paginator.page : empty()) as Observable<PageEvent | null>;
183185

184186
if (this._renderChangesSubscription) {
185187
this._renderChangesSubscription.unsubscribe();
@@ -190,10 +192,10 @@ export class MatTableDataSource<T> extends DataSource<T> {
190192
combineLatest(this._filter),
191193
map(([data]) => this._filterData(data)),
192194
// Watch for filtered data or sort changes to provide an ordered set of data.
193-
combineLatest(sortChange.pipe(startWith(null!))),
195+
combineLatest(sortChange.pipe(startWith(null))),
194196
map(([data]) => this._orderData(data)),
195197
// Watch for ordered data or page changes to provide a paged set of data.
196-
combineLatest(pageChange.pipe(startWith(null!))),
198+
combineLatest(pageChange.pipe(startWith(null))),
197199
map(([data]) => this._pageData(data))
198200
)
199201
// Watched for paged data changes and send the result to the table to render.

0 commit comments

Comments
 (0)