Skip to main content

CommonHas

Callable

  • CommonHas<T>(obj: { has: (key: T) => boolean }, key: unknown): key is T

  • A Set.has/Map.has version annotated to return a type guard.


    Type parameters

    • T

    Parameters

    • obj: { has: (key: T) => boolean }

      The set or map in question

      • has: (key: T) => boolean
    • key: unknown

      The key to search for

    Returns key is T

    Whether the object contains the passed key