Skip to content

Commit d27138a

Browse files
author
Harold Favereau
committed
make if truthy strictNullCheck compliant
1 parent f039a35 commit d27138a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/operator/if-truthy.operator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { filter } from 'rxjs/operators';
2-
import { MonoTypeOperatorFunction, Observable } from 'rxjs';
1+
import {Observable, OperatorFunction} from 'rxjs';
2+
import {filter} from 'rxjs/operators';
33

44
/**
55
* filter !!value
66
*/
7-
export function ifTruthy<I>(): MonoTypeOperatorFunction<I> {
7+
export function ifTruthy<I>(): OperatorFunction<NonNullable<I> | null | undefined, NonNullable<I>> {
88
return (source$: Observable<I>) => source$.pipe(
9-
filter((input: I) => !!input)
9+
filter((input: I | null | undefined): input is NonNullable<I> => !!input)
1010
);
1111
}

0 commit comments

Comments
 (0)