@@ -5,65 +5,116 @@ it('should infer correctly with 1 parameter', () => {
55 const o = race ( a ) ; // $ExpectType Observable<number>
66} ) ;
77
8- it ( 'should infer correctly with multiple parameters of the same type' , ( ) => {
9- const a = of ( 1 ) ;
10- const b = of ( 2 ) ;
11- const o = race ( a , b ) ; // $ExpectType Observable<number>
12- } ) ;
8+ describe ( 'race(a, b, c)' , ( ) => {
9+ it ( 'should infer correctly with multiple parameters of the same type' , ( ) => {
10+ const a = of ( 1 ) ;
11+ const b = of ( 2 ) ;
12+ const o = race ( a , b ) ; // $ExpectType Observable<number>
13+ } ) ;
1314
14- it ( 'should support 2 parameters with different types' , ( ) => {
15- const a = of ( 1 ) ;
16- const b = of ( 'a' ) ;
17- const o = race ( a , b ) ; // $ExpectType Observable<string> | Observable< number>
18- } ) ;
15+ it ( 'should support 2 parameters with different types' , ( ) => {
16+ const a = of ( 1 ) ;
17+ const b = of ( 'a' ) ;
18+ const o = race ( a , b ) ; // $ExpectType Observable<string | number>
19+ } ) ;
1920
20- it ( 'should support 3 parameters with different types' , ( ) => {
21- const a = of ( 1 ) ;
22- const b = of ( 'a' ) ;
23- const c = of ( true ) ;
24- const o = race ( a , b , c ) ; // $ExpectType Observable<string> | Observable< number> | Observable< boolean>
25- } ) ;
21+ it ( 'should support 3 parameters with different types' , ( ) => {
22+ const a = of ( 1 ) ;
23+ const b = of ( 'a' ) ;
24+ const c = of ( true ) ;
25+ const o = race ( a , b , c ) ; // $ExpectType Observable<string | number | boolean>
26+ } ) ;
2627
27- it ( 'should support 4 parameters with different types' , ( ) => {
28- const a = of ( 1 ) ;
29- const b = of ( 'a' ) ;
30- const c = of ( true ) ;
31- const d = of ( [ 1 , 2 , 3 ] ) ;
32- const o = race ( a , b , c , d ) ; // $ExpectType Observable<string> | Observable< number> | Observable< boolean> | Observable< number[]>
33- } ) ;
28+ it ( 'should support 4 parameters with different types' , ( ) => {
29+ const a = of ( 1 ) ;
30+ const b = of ( 'a' ) ;
31+ const c = of ( true ) ;
32+ const d = of ( [ 1 , 2 , 3 ] ) ;
33+ const o = race ( a , b , c , d ) ; // $ExpectType Observable<string | number | boolean | number[]>
34+ } ) ;
3435
35- it ( 'should support 5 parameters with different types' , ( ) => {
36- const a = of ( 1 ) ;
37- const b = of ( 'a' ) ;
38- const c = of ( true ) ;
39- const d = of ( [ 1 , 2 , 3 ] ) ;
40- const e = of ( [ 'blah' ] ) ;
41- const o = race ( a , b , c , d , e ) ; // $ExpectType Observable<string> | Observable< number> | Observable< boolean> | Observable< number[]> | Observable< string[]>
42- } ) ;
36+ it ( 'should support 5 parameters with different types' , ( ) => {
37+ const a = of ( 1 ) ;
38+ const b = of ( 'a' ) ;
39+ const c = of ( true ) ;
40+ const d = of ( [ 1 , 2 , 3 ] ) ;
41+ const e = of ( [ 'blah' ] ) ;
42+ const o = race ( a , b , c , d , e ) ; // $ExpectType Observable<string | number | boolean | number[] | string[]>
43+ } ) ;
4344
44- it ( 'should support 6 or more parameters of the same type' , ( ) => {
45- const a = of ( 1 ) ;
46- const o = race ( a , a , a , a , a , a , a , a , a , a , a , a , a , a ) ; // $ExpectType Observable<number>
45+ it ( 'should support 6 or more parameters of the same type' , ( ) => {
46+ const a = of ( 1 ) ;
47+ const o = race ( a , a , a , a , a , a , a , a , a , a , a , a , a , a ) ; // $ExpectType Observable<number>
48+ } ) ;
49+
50+ it ( 'should return {} for 6 or more arguments of different types' , ( ) => {
51+ const a = of ( 1 ) ;
52+ const b = of ( 'a' ) ;
53+ const c = of ( true ) ;
54+ const d = of ( [ 1 , 2 , 3 ] ) ;
55+ const e = of ( [ 'blah' ] ) ;
56+ const f = of ( { foo : 'bar' } ) ;
57+ const o = race ( a , b , c , d , e , f ) ; // $ExpectType Observable<{}>
58+ } ) ;
4759} ) ;
4860
49- it ( 'should return {} for 6 or more arguments of different types' , ( ) => {
50- const a = of ( 1 ) ;
51- const b = of ( 'a' ) ;
52- const c = of ( true ) ;
53- const d = of ( [ 1 , 2 , 3 ] ) ;
54- const e = of ( [ 'blah' ] ) ;
55- const f = of ( { foo : 'bar' } ) ;
56- const o = race ( a , b , c , d , e , f ) ; // $ExpectType Observable<{}>
61+ describe ( 'race([a, b, c])' , ( ) => {
62+ it ( 'should infer correctly with multiple parameters of the same type' , ( ) => {
63+ const a = of ( 1 ) ;
64+ const b = of ( 2 ) ;
65+ const o = race ( [ a , b ] ) ; // $ExpectType Observable<number>
66+ } ) ;
67+
68+ it ( 'should support 2 parameters with different types' , ( ) => {
69+ const a = of ( 1 ) ;
70+ const b = of ( 'a' ) ;
71+ const o = race ( [ a , b ] ) ; // $ExpectType Observable<string | number>
72+ } ) ;
73+
74+ it ( 'should support 3 parameters with different types' , ( ) => {
75+ const a = of ( 1 ) ;
76+ const b = of ( 'a' ) ;
77+ const c = of ( true ) ;
78+ const o = race ( [ a , b , c ] ) ; // $ExpectType Observable<string | number | boolean>
79+ } ) ;
80+
81+ it ( 'should support 4 parameters with different types' , ( ) => {
82+ const a = of ( 1 ) ;
83+ const b = of ( 'a' ) ;
84+ const c = of ( true ) ;
85+ const d = of ( [ 1 , 2 , 3 ] ) ;
86+ const o = race ( [ a , b , c , d ] ) ; // $ExpectType Observable<string | number | boolean | number[]>
87+ } ) ;
88+
89+ it ( 'should support 5 parameters with different types' , ( ) => {
90+ const a = of ( 1 ) ;
91+ const b = of ( 'a' ) ;
92+ const c = of ( true ) ;
93+ const d = of ( [ 1 , 2 , 3 ] ) ;
94+ const e = of ( [ 'blah' ] ) ;
95+ const o = race ( [ a , b , c , d , e ] ) ; // $ExpectType Observable<string | number | boolean | number[] | string[]>
96+ } ) ;
97+
98+ it ( 'should support 6 or more parameters of the same type' , ( ) => {
99+ const a = of ( 1 ) ;
100+ const o = race ( [ a , a , a , a , a , a , a , a , a , a , a , a , a , a ] ) ; // $ExpectType Observable<number>
101+ } ) ;
102+
103+ it ( 'should return {} for 6 or more arguments of different types' , ( ) => {
104+ const a = of ( 1 ) ;
105+ const b = of ( 'a' ) ;
106+ const c = of ( true ) ;
107+ const d = of ( [ 1 , 2 , 3 ] ) ;
108+ const e = of ( [ 'blah' ] ) ;
109+ const f = of ( { foo : 'bar' } ) ;
110+ const o = race ( [ a , b , c , d , e , f ] ) ; // $ExpectType Observable<{}>
111+ } ) ;
57112} ) ;
58113
59- it ( 'should handle an array of observables' , ( ) => {
60- const a = of ( 1 ) ;
61- const b = of ( 2 ) ;
62- const o = race ( [ a , b ] ) ; // $ExpectType Observable<number>
114+ it ( 'should race observable inputs' , ( ) => {
115+ const o = race ( of ( 1 ) , Promise . resolve ( 'foo' ) , [ true , false ] ) ; // $ExpectType Observable<string | number | boolean>
63116} ) ;
64117
65- it ( 'should return {} for array of observables of different types' , ( ) => {
66- const a = of ( 1 ) ;
67- const b = of ( 'test' ) ;
68- const o = race ( [ a , b ] ) ; // $ExpectType Observable<{}>
118+ it ( 'should race an array observable inputs' , ( ) => {
119+ const o = race ( [ of ( 1 ) , Promise . resolve ( 'foo' ) , [ true , false ] ] ) ; // $ExpectType Observable<string | number | boolean>
69120} ) ;
0 commit comments