Function skipPropertyNil

  • Skips values which contains null or undefined for the given property. Narrows the type of the given property within the object type from T | null | undefined to T.

    marble

    Example:

    const x: Observable<{ a: number, b: string | null | undefined }>;

    const z: Observable<{ a: number, b: string }> = x.pipe(
    skipPropertyNil('b')
    );

    value { a: 1, b: 'foo' } will pass through

    value { a: 1, b: null } will be skipped

    value { a: 1, b: undefined } will be skipped

    Type Parameters

    • T extends object

    • P extends string | number | symbol

    Parameters

    • prop: P

      name of the property to check

    Returns ((source) => Observable<PropertyNotNil<T, P>>)

      • (source): Observable<PropertyNotNil<T, P>>
      • Parameters

        • source: Observable<T>

        Returns Observable<PropertyNotNil<T, P>>

Generated using TypeDoc