Hex Core JS
    Preparing search index...

    Function subsetTypeHasKey

    • Type guard to check whether the given object (of a subset type constructed from another with Pick and a parameterized key type) has the given key (which is available on the main type T). In other words, reports whether SK extends K.

      Type Parameters

      • T
      • SK extends string | number | symbol
      • K extends string | number | symbol

      Parameters

      • object: Pick<T, SK>

        The object to check.

      • key: K

        The key to check for.

      Returns object is Pick<T, SK | K>

    • Type guard to check whether the given object (of a subset type constructed from another with Partial and Pick and a parameterized key type) has the given key (which is available on the main type T). In other words, reports whether SK extends K.

      Type Parameters

      • T
      • SK extends string | number | symbol
      • K extends string | number | symbol

      Parameters

      • object: Partial<Pick<T, SK>>

        The object to check.

      • key: K

        The key to check for.

      Returns object is Partial<Pick<T, SK | K>>