Skip to main content

CommonHas

Callable

  • CommonHas<T>(obj, key): key is T

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


    Parameters

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

      The set or map in question

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

      The key to search for

    Returns key is T

    Whether the object contains the passed key