@w11k/rx-ninja
    Preparing search index...

    Function isPropertyNotNull

    • Returns a type guard function, which receives an object and checks if the given property is not null. Narrows the type of the given property within the object type from T | null to just T.

      Example:

      incoming type is { a: number, b: string | null }

      outgoing type of returned type guard from propertyNotNull('b') is { a: number, b: string }

      Type Parameters

      • T
      • P extends string | number | symbol

      Parameters

      • property: P

        name of the property to check

      Returns (
          obj: T,
      ) => obj is {
          [X in string | number | symbol]: X extends P ? NonNull<T[X]> : T[X]
      }