RxJS: How to Use Type Guards with Observables
3 min readSep 11, 2017
Since version 1.6, TypeScript has supported user-defined type guards.
When composing an observable, a type guard can be used to ensure that the correct type is inferred at compile time and that the received value is validated at run time. With run-time validation, problems can be caught early and descriptive errors can be thrown from locations close to where values are received — these…