Skip to content

Instantly share code, notes, and snippets.

@armanozak
Created May 3, 2021 08:47
Show Gist options
  • Save armanozak/a30bcf7a19593d9625de73b29638bed4 to your computer and use it in GitHub Desktop.
Save armanozak/a30bcf7a19593d9625de73b29638bed4 to your computer and use it in GitHub Desktop.
[What's New in RxJS 7] Better types with filter(Boolean) #blog #rxjs
import { of } from "rxjs";
import { filter } from "rxjs/operators";
// Observable<"" | 0 | null | undefined | Date>
of("" as const, 0 as const, null, undefined, new Date())
.pipe(filter(Boolean))
.subscribe();
// Observable<Date> (in RxJS 6 → Observable<unknown>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment