We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f039a35 commit 76d510fCopy full SHA for 76d510f
src/operator/if-truthy.operator.ts
@@ -1,11 +1,9 @@
1
-import { filter } from 'rxjs/operators';
2
-import { MonoTypeOperatorFunction, Observable } from 'rxjs';
+import {OperatorFunction} from 'rxjs';
+import {filter} from 'rxjs/operators';
3
4
/**
5
* filter !!value
6
*/
7
-export function ifTruthy<I>(): MonoTypeOperatorFunction<I> {
8
- return (source$: Observable<I>) => source$.pipe(
9
- filter((input: I) => !!input)
10
- );
+export function ifTruthy<I>(): OperatorFunction<NonNullable<I> | null | undefined, NonNullable<I>> {
+ return filter((input: I | null | undefined): input is NonNullable<I> => !!input);
11
}
0 commit comments