Function arrayContains

  • Checks if a given item is in a readonly array, acting as a typeguard.

    Type Parameters

    • T
    • A

    Parameters

    • item: T

      Needle

    • array: readonly A[]

      Readonly array haystack

    Returns item is A

    Whether the item is in the array, and narrows the type of the item.