File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { expect } from 'chai' ;
2
2
import { map , tap , mergeMap , take } from 'rxjs/operators' ;
3
3
import { TestScheduler } from 'rxjs/testing' ;
4
- import { of , Observable , identity } from 'rxjs' ;
4
+ import { of , Observable , identity , Observer } from 'rxjs' ;
5
5
import { observableMatcher } from '../helpers/observableMatcher' ;
6
6
7
7
// function shortcuts
@@ -279,4 +279,29 @@ describe('map', () => {
279
279
280
280
expect ( sideEffects ) . to . deep . equal ( [ 0 , 1 , 2 ] ) ;
281
281
} ) ;
282
+
283
+ describe ( 'no lift' , ( ) => {
284
+ it ( 'can operate on any Observable-shaped object' , ( ) => {
285
+ const source = {
286
+ subscribe ( observer : Observer < number > ) {
287
+ observer . next ( 1 ) ;
288
+ observer . next ( 2 ) ;
289
+ observer . next ( 3 ) ;
290
+ observer . complete ( ) ;
291
+ return {
292
+ unsubscribe ( ) {
293
+ // noop
294
+ } ,
295
+ } ;
296
+ } ,
297
+ } ;
298
+ const results : any [ ] = [ ] ;
299
+
300
+ map ( ( x : number ) => x + '!!!' ) ( source ) . subscribe ( ( value : string ) => {
301
+ results . push ( value ) ;
302
+ } ) ;
303
+
304
+ expect ( results ) . to . deep . equal ( [ '1!!!' , '2!!!' , '3!!!' ] ) ;
305
+ } ) ;
306
+ } ) ;
282
307
} ) ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export interface UnaryFunction<T, R> {
20
20
( source : T ) : R ;
21
21
}
22
22
23
- export interface OperatorFunction < T , R > extends UnaryFunction < Observable < T > , Observable < R > > { }
23
+ export interface OperatorFunction < T , R > extends UnaryFunction < Subscribable < T > , Observable < R > > { }
24
24
25
25
export type FactoryOrValue < T > = T | ( ( ) => T ) ;
26
26
You can’t perform that action at this time.
0 commit comments