-
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.
Overload take while to accept a type guard (#4085)
* feat(takeWhile): overload takeWhile to accept a type guard * test(takeWhile): add type guard tests for takeWhile * test(dtslint): add takeWhile
- Loading branch information
1 parent
70fa26e
commit af7b619
Showing
3 changed files
with
61 additions
and
2 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,10 @@ | ||
import { of } from 'rxjs'; | ||
import { takeWhile } from 'rxjs/operators'; | ||
|
||
it('should support a user-defined type guard', () => { | ||
const o = of('foo').pipe(takeWhile((s): s is 'foo' => true)); // $ExpectType Observable<"foo"> | ||
}); | ||
|
||
it('should support a predicate', () => { | ||
const o = of('foo').pipe(takeWhile(s => true)); // $ExpectType Observable<string> | ||
}); |
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
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