forked from ReactiveX/rxjs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes ReactiveX#3969.
- Loading branch information
Showing
1 changed file
with
26 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,26 @@ | ||
import { of } from 'rxjs'; | ||
import { find } from 'rxjs/operators'; | ||
|
||
it('should support a user-defined type guard', () => { | ||
const o = of('foo').pipe(find((s: string): s is 'foo' => true)); // $ExpectType Observable<"foo" | undefined> | ||
}); | ||
|
||
it('should support a user-defined type guard that takes an index', () => { | ||
const o = of('foo').pipe(find((s, index): s is 'foo' => true)); // $ExpectType Observable<"foo" | undefined> | ||
}); | ||
|
||
it('should support a user-defined type guard that takes an index and the source', () => { | ||
const o = of('foo').pipe(find((s, index): s is 'foo' => true)); // $ExpectType Observable<"foo" | undefined> | ||
}); | ||
|
||
it('should support a predicate', () => { | ||
const o = of('foo').pipe(find(s => true)); // $ExpectType Observable<string | undefined> | ||
}); | ||
|
||
it('should support a predicate that takes an index', () => { | ||
const o = of('foo').pipe(find((s, index) => true)); // $ExpectType Observable<string | undefined> | ||
}); | ||
|
||
it('should support a predicate that takes an index and the source', () => { | ||
const o = of('foo').pipe(find((s, index, source) => true)); // $ExpectType Observable<string | undefined> | ||
}); |