@@ -104,7 +104,7 @@ export abstract class MatDataSource<REQ = any, RAW = any, RES = any>
104
104
get outputMsg ( ) {
105
105
return this . _outputMsg ;
106
106
}
107
- protected _outputMsg : string ;
107
+ protected _outputMsg : string = '' ;
108
108
109
109
/**
110
110
* Accessors
@@ -155,7 +155,7 @@ export abstract class MatDataSource<REQ = any, RAW = any, RES = any>
155
155
*/
156
156
protected defaults : Partial < REQ > = { } ;
157
157
protected overrides : Partial < REQ > = { } ;
158
- protected arguments : REQ & DataSourceOpts ;
158
+ protected arguments ? : REQ & DataSourceOpts ;
159
159
160
160
/**
161
161
* Error control vars.
@@ -227,9 +227,9 @@ export abstract class MatDataSource<REQ = any, RAW = any, RES = any>
227
227
) : string {
228
228
const src : DataSourceStream < REQ | DataSourceOpts > = isObservable ( stream )
229
229
? {
230
- name : this . _streams . length . toString ( ) ,
231
- stream,
232
- }
230
+ name : this . _streams . length . toString ( ) ,
231
+ stream,
232
+ }
233
233
: stream ;
234
234
235
235
this . _logger . check ( this . _triggered , addWhenRunning ( src . name || src . stream ) ) ;
@@ -311,9 +311,9 @@ export abstract class MatDataSource<REQ = any, RAW = any, RES = any>
311
311
...this . overrides ,
312
312
} as any ;
313
313
314
- delete this . arguments . forceReload ;
314
+ delete this . arguments ? .forceReload ;
315
315
316
- return this . arguments ;
316
+ return this . args ;
317
317
}
318
318
319
319
private _isEqual ( ) : ( prev : REQ , curr : REQ ) => boolean {
@@ -342,28 +342,27 @@ export abstract class MatDataSource<REQ = any, RAW = any, RES = any>
342
342
return merge (
343
343
query ,
344
344
// timers check
345
- timer ( this . config . waitMs , this . config . intervalMs ) . pipe (
345
+ timer ( this . config . waitMs ?? 5000 , this . config . intervalMs || 10000 ) . pipe (
346
346
takeUntil ( query ) ,
347
- take ( 3 ) // by default: 5s, 15s, 25s
348
- )
349
- ) . pipe (
350
- // delay check
351
- tap ( ( val ) => {
352
- if ( typeof val !== 'number' ) {
353
- this . _logger . print ( queryResponse ( ) , val ) ;
354
- } else {
355
- this . _logger . print ( queryTimeout ( ) , val ) ;
347
+ take ( 3 ) , // by default: 5s, 15s, 25s
348
+ tap ( ( sequence ) => {
349
+ this . _logger . print ( queryTimeout ( ) , sequence ) ;
356
350
try {
357
- this . _outputMsg = this . _logger . getTimeoutError ( val ) ;
358
- } catch ( e ) {
359
- this . _logger . addError ( 'timeout' , e . message ) ;
351
+ this . _outputMsg = this . _logger . getTimeoutError ( sequence ) ;
352
+ } catch ( e : unknown ) {
353
+ if ( e instanceof Error ) {
354
+ this . _logger . addError ( 'timeout' , e . message ) ;
355
+ }
360
356
this . _loading = false ;
361
357
}
362
358
this . _change$ . next ( { } ) ;
363
- }
364
- } ) ,
365
- // discard timer result
366
- filter < RAW > ( ( result ) => typeof result !== 'number' ) ,
359
+ } ) ,
360
+ filter ( ( result : number | RAW ) : result is RAW => {
361
+ return typeof result !== 'number' ;
362
+ } )
363
+ )
364
+ ) . pipe (
365
+ tap ( ( result ) => this . _logger . print ( queryResponse ( ) , result ) ) ,
367
366
catchError ( ( err ) => {
368
367
// isolate query error
369
368
this . _logger . handleError ( 'query' , err ) ;
0 commit comments