Last active
July 13, 2024 08:05
-
-
Save vorant94/08c16809ec61185f8d72d355413627d2 to your computer and use it in GitHub Desktop.
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
import { filter, map, Observable, OperatorFunction } from 'rxjs'; | |
export function nonNullable<T>(): OperatorFunction<T, NonNullable<T>> { | |
return function (source$: Observable<T>): Observable<NonNullable<T>> { | |
return source$.pipe( | |
filter((value): value is T => value != null) | |
); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment