-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { of, concat, asyncScheduler } from 'rxjs'; | ||
|
||
it('should accept 1 param', () => { | ||
const o = concat(of(1)); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept 2 params', () => { | ||
const o = concat(of(1), of(2)); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept 3 params', () => { | ||
const o = concat(of(1), of(2), of(3)); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept 4 params', () => { | ||
const o = concat(of(1), of(2), of(3), of(4)); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept 5 params', () => { | ||
const o = concat(of(1), of(2), of(3), of(4), of(5)); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept 6 params', () => { | ||
const o = concat(of(1), of(2), of(3), of(4), of(5), of(6)); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept more than 6 params', () => { | ||
const o = concat(of(1), of(2), of(3), of(4), of(5), of(6), of(7), of(8), of(9)); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept scheduler after params', () => { | ||
const o = concat(of(4), of(5), of(6), asyncScheduler); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept promises', () => { | ||
const o = concat(Promise.resolve(4)); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept arrays', () => { | ||
const o = concat([4, 5]); // $ExpectType Observable<number> | ||
}); | ||
|
||
it('should accept iterables', () => { | ||
const o = concat([1], 'foo'); // $ExpectType Observable<string | number> | ||
}); | ||
|
||
it('should infer correctly with multiple types', () => { | ||
const o = concat(of('foo'), Promise.resolve<number[]>([1]), of(6)); // $ExpectType Observable<string | number | number[]> | ||
}); | ||
|
||
it('should enforce types', () => { | ||
const o = concat(5); // $ExpectError | ||
const p = concat(of(5), 6); // $ExpectError | ||
}); |