/** * @license Use of this source code is governed by an MIT-style license that * can be found in the LICENSE file at https://github.com/cartant/rxjs-etc */ import { Observable, OperatorFunction, SchedulerLike } from "rxjs"; export type ObservableValue = T extends Observable ? U : never; export type ObservableValues = { [K in keyof T]: ObservableValue }; // https://github.com/ReactiveX/rxjs/issues/4632#issuecomment-481815411 export type Op = OperatorFunction; export function isNonNulled(value: T): value is NonNullable { return value != null; } /** @deprecated Renamed to isNonNulled */ export const isNotNullish = isNonNulled; export function isNulled( value: T | null | undefined ): value is null | undefined { return value == null; } /** @deprecated Renamed to isNulled */ export const isNullish = isNulled; export function isObservable(value: any): value is Observable { return Boolean( value && typeof value === "object" && typeof value["subscribe"] === "function" ); } export function isScheduler( value: object | null | undefined ): value is SchedulerLike { return Boolean(value && typeof (value as any)["schedule"] === "function"); }