Skip to main content

CommonIncludes

Callable

  • CommonIncludes<T>(array: readonly T[], searchElement: unknown, fromIndex?: number): searchElement is T

  • A Array.includes version annotated to return a type guard.


    Type parameters

    • T

    Parameters

    • array: readonly T[]

      The array in question

    • searchElement: unknown

      The value to search for

    • optionalfromIndex: number

      Zero-based index at which to start searching

    Returns searchElement is T

    Whether the array contains the passed element